- TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
- TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
- Tables CrTables;
-
- ConnectionInfo Cr = new ConnectionInfo();
- Cr.ServerName = "";//here you should provide your Server Name
- Cr.DatabaseName = "";//here you should provide your Database Name
- Cr.UserID = "";//here you should provide your User Name
- Cr.Password = "";//here you should provide your Password
- CrTables = Ip.Database.Tables;
-
- foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
- {
- crtableLogoninfo = CrTable.LogOnInfo;
- crtableLogoninfo.ConnectionInfo = Cr;
- CrTable.ApplyLogOnInfo(crtableLogoninfo);
- }
- crystalReportViewer1.ReportSource = Ip;
In this code I have created a crystal report and created its object IP and used that in the report source.Here I am going to show you how to dynamically login in Crystal Reports. Sometimes developer faces the issue that he has to provide server name and etc this code will help you to remove those exceptions in applications.

Join the conversation! Your thoughts help the community grow.