Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ReportDocument cryRpt = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables ;

cryRpt.Load("C:\\Users\\Administrator\\Documents\\Visual Studio 2010\\Projects\\WindowsFormsApplication2\\WindowsFormsApplication2\\CrystalReport2.rpt");

crConnectionInfo.ServerName = "Student-PC\\sqlexpress";
crConnectionInfo.DatabaseName = "dairymDataSet";
crConnectionInfo.UserID = "dairy";
crConnectionInfo.Password = "dairy";
// crConnectionInfo.IntegratedSecurity = false;

CrTables = cryRpt.Database.Tables ;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}

crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
Posted
Updated 25-Oct-13 17:33pm
v3
Comments
thatraja 28-Oct-13 11:58am    
what's the error?

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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