ASP.NET Crystal Report ODBC MySQL

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2005
Posts: 7
Reputation: digioz is an unknown quantity at this point 
Solved Threads: 0
digioz's Avatar
digioz digioz is offline Offline
Newbie Poster

ASP.NET Crystal Report ODBC MySQL

 
0
  #1
Sep 23rd, 2006
I am trying to display a Crystal Report developed using MySQL database and ASP.NET 2.0 (VS.NET 2005), and for some reason when I pass the database login information to the report it does not accept them (still shows a db login screen). Here is the code:

  1.  
  2. Dim cnString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=servername;DATABASE=dbname;UID=user name;PASSWORD=password;OPTION=3"
  3. Dim cn As New OdbcConnection(cnString)
  4. cn.Open()
  5. Dim MyReport As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent
  6. MyReport.Load("C:\Inetpub\wwwroot\Report1.rpt")
  7. MyReport.SetDataSource(cnString)
  8. MyReport.SetDatabaseLogon("username", "password")
  9. MyReport.SetParameterValue("parameter1", "1001")
  10. CrystalReportViewer1.ReportSource = MyReport
  11. CrystalReportViewer1.DataBind()
  12. cn.Close()

I have one Crystal Report Viewer and one Crystal Report Source objects on the form. The Crystal Report Source is set to "Report1.rpt" and the Viewer's source is set to that as well. When I run it, I get a parameter field request followed by a server login information request.

The actual Report properties are:

Database DLL: crdb_odbc.dll
DSN: NameOfDSNSource
UseDSNProperties: False
UserID: databaseUserName

I have even tried this:

  1. Imports CrystalDecisions.CrystalReports.Engine
  2. Imports CrystalDecisions.Shared
  3. Imports System.IO
  4. Imports MySql.Data.MySqlClient
  5.  
  6. ' Class Name etc here ...
  7.  
  8. Dim conn As New MySqlConnection
  9.  
  10. conn = New MySqlConnection("Server=servername; Database=dbname; User ID=dbuser; Password=dbpass; charset=utf8;")
  11. conn.Open()
  12. Dim MyReport As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent
  13. MyReport.Load("C:\Inetpub\wwwroot\Report1.rpt")
  14. MyReport.SetDataSource("Server=servername; Database=dbname; User ID=dbuser; Password=dbpass; charset=utf8;")
  15. MyReport.SetParameterValue("parameter1", "1001")
  16. CrystalReportViewer1.ReportSource = MyReport
  17. CrystalReportViewer1.DataBind()
  18.  

But so far no luck. Does anyone know what the problem is with it? Any help would be appreciated.

Thank You
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 1
Reputation: jeni73 is an unknown quantity at this point 
Solved Threads: 0
jeni73 jeni73 is offline Offline
Newbie Poster

Re: ASP.NET Crystal Report ODBC MySQL

 
0
  #2
Mar 1st, 2007
Have you tried just passing the database login for the crystal report?

Try this guide and see if it helps:

http://www.instantcrystal.net/instantguide.aspx
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 7
Reputation: digioz is an unknown quantity at this point 
Solved Threads: 0
digioz's Avatar
digioz digioz is offline Offline
Newbie Poster

Re: ASP.NET Crystal Report ODBC MySQL

 
0
  #3
Mar 2nd, 2007
Originally Posted by jeni73 View Post
Have you tried just passing the database login for the crystal report?

Try this guide and see if it helps:

http://www.instantcrystal.net/instantguide.aspx
Thank you. I actually did solve my problem a few month ago. The only thing I was doing wrong was I was trying to pass the database login information to the report, while setting the wizard that comes with the Crystal Report Viewer at the same time! I took out the information in the wizard and it worked like a charm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC