944,014 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 2527
  • ASP.NET RSS
Nov 4th, 2009
0

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

Expand Post »
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.
Similar Threads
Reputation Points: 4
Solved Threads: 2
Light Poster
shine_jose is offline Offline
48 posts
since Jul 2009
Nov 5th, 2009
0
Re: To pass login information in asp.net c# crystal report
Try this.
ASP.NET Syntax (Toggle Plain Text)
  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#
Reputation Points: 165
Solved Threads: 113
Posting Pro
Ramesh S is offline Offline
580 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Help with insert statement
Next Thread in ASP.NET Forum Timeline: Web form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC