ASP.NET 2.0 Crystal Report issue MySQL DB (1 Viewer)

digioz

New member
Local time
Yesterday, 23:46
Joined
Sep 23, 2006
Messages
1
Hi,

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:

Code:
Dim cnString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=servername;DATABASE=dbname;UID=user  name;PASSWORD=password;OPTION=3"
Dim cn As New OdbcConnection(cnString)
cn.Open()
Dim MyReport As New CrystalDecisions.CrystalReports.Engine.ReportDocum  ent
MyReport.Load("C:\Inetpub\wwwroot\Report1.rpt")
MyReport.SetDataSource(cnString)
MyReport.SetDatabaseLogon("username", "password")
MyReport.SetParameterValue("parameter1", "1001")
CrystalReportViewer1.ReportSource = MyReport
CrystalReportViewer1.DataBind()
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:

Code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.IO
Imports MySql.Data.MySqlClient
 
' Class Name etc here ...
 
Dim conn As New MySqlConnection
 
conn = New MySqlConnection("Server=servername; Database=dbname; User ID=dbuser; Password=dbpass; charset=utf8;")
conn.Open()
Dim MyReport As New CrystalDecisions.CrystalReports.Engine.ReportDocum  ent
MyReport.Load("C:\Inetpub\wwwroot\Report1.rpt")
MyReport.SetDataSource("Server=servername; Database=dbname; User ID=dbuser; Password=dbpass; charset=utf8;")
MyReport.SetParameterValue("parameter1", "1001")
CrystalReportViewer1.ReportSource = MyReport
CrystalReportViewer1.DataBind()

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

Thank You
 

Users who are viewing this thread

Top Bottom