To pass login information in asp.net c# crystal report

Thread Solved

Join Date: Jul 2009
Posts: 22
Reputation: shine_jose has a little shameless behaviour in the past 
Solved Threads: 0
shine_jose shine_jose is offline Offline
Newbie Poster

To pass login information in asp.net c# crystal report

 
0
  #1
Nov 4th, 2009
Hello,
I wish to get the code to pass the log in information (i.e server name,pass word etc) as parameter at the time of calling report
Now its asking (user name ,password) before going to the report page each time .please help me.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 452
Reputation: Ramesh S will become famous soon enough Ramesh S will become famous soon enough 
Solved Threads: 82
Ramesh S Ramesh S is offline Offline
Posting Pro in Training
 
0
  #2
Nov 5th, 2009
Try this.
  1. ReportDocument cryRpt = new ReportDocument();
  2. TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
  3. TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
  4. ConnectionInfo crConnectionInfo = new ConnectionInfo();
  5. Tables CrTables ;
  6.  
  7. cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt");
  8.  
  9. crConnectionInfo.ServerName = "YOUR SERVER NAME";
  10. crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
  11. crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
  12. crConnectionInfo.Password = "YOUR DATABASE PASSWORD";
  13.  
  14. CrTables = cryRpt.Database.Tables ;
  15. foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
  16. {
  17. crtableLogoninfo = CrTable.LogOnInfo;
  18. crtableLogoninfo.ConnectionInfo = crConnectionInfo;
  19. CrTable.ApplyLogOnInfo(crtableLogoninfo);
  20. }
  21.  
  22. crystalReportViewer1.ReportSource = cryRpt;
  23. crystalReportViewer1.Refresh();


Reference: C# Crystal Reports Dynamic Logon parameters

Also refer this link.

How to pass Database logon info to a Crystal Report at runtime in VB .NET or in C#
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 608 | Replies: 1
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC