Click here to Skip to main content
15,921,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Login failed incorrect login details error for crystal report for visual studio 2008 when hosting in windows server 2012. Its working fine in windows server 2003.
Code as follows:
Under page load
public void ViewReportCR()
{
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

string conString = Common.GetConnectionStringsSection().ConnectionStrings["connectionStrings"].ConnectionString;
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(conString);



reportDocument.Load(Server.MapPath("~//Reports//CRSensorDataReport.rpt"));
ConnectionInfo connectionInfo = new ConnectionInfo( );
connectionInfo.ServerName =builder.DataSource;
connectionInfo.DatabaseName = builder.InitialCatalog;
connectionInfo.UserID = builder.UserID;
connectionInfo.Password = builder.Password;
connectionInfo.Type = ConnectionInfoType.SQL;
connectionInfo.IntegratedSecurity = false;

TableLogOnInfo rptTableLogOnInfo =new TableLogOnInfo( );
rptTableLogOnInfo.ConnectionInfo=connectionInfo;
for(int i=0;i<reportdocument.database.tables.count;i++)>
reportDocument.Database.Tables[i].ApplyLogOnInfo( rptTableLogOnInfo );

if (ddlSystemID.SelectedIndex != 0)
reportDocument.SetParameterValue("@ip_SystemID", ddlSystemID.SelectedValue);
else
reportDocument.SetParameterValue("@ip_SystemID", 0);
if (ddlSensorType.SelectedIndex != 0)
reportDocument.SetParameterValue("@ip_SensorType", ddlSensorType.SelectedValue);
else
reportDocument.SetParameterValue("@ip_SensorType", -1);
if (ddlParamName.SelectedIndex != 0)
reportDocument.SetParameterValue("@ip_ParamName", ddlParamName.SelectedValue);
else
reportDocument.SetParameterValue("@ip_ParamName", 0);
if (txtFromDate.Text != "")
reportDocument.SetParameterValue("@ip_FromDate", txtFromDate.Text);
else
reportDocument.SetParameterValue("@ip_FromDate", "");
if (txtToDate.Text != "")
reportDocument.SetParameterValue("@ip_ToDate", txtToDate.Text);
else
reportDocument.SetParameterValue("@ip_ToDate", "");

//if (ddlSystemID.SelectedIndex != 0 && txtFromDate.Text != "" && txtToDate.Text != "" && reportDocument.Rows.Count != 0)
//{



CrystalReportViewer1.ToolbarStyle.Width = new Unit("100%");
CrystalReportViewer1.ReportSource = reportDocument;



CrystalReportViewer1.Visible = true;
//}

}
Posted
Updated 19-Sep-13 4:53am
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900