I am trying to integrate a Crystal 2011 report into VB.NET 2012 with the new Visual Studio add on to VB.NET 2012. All the code worked until I moved from Access 2000 to Access 2007. The report opens with " Logon Failed Please try again" I click on the OK and press the refresh button in the report. The report runs. How do I get rid of the logon error.
Thanks for any help.
here is my code:
Dim Report AsNewReportDocument
Dim Connection AsIConnectionInfo
Dim crconnectioninfo AsNewConnectionInfo
Dim ReportName AsString
Dim OldserverName AsString = ""
Dim OldDatabaseName AsString = ""
Dim NewDatabaseName AsString = Application.StartupPath + "\ddkwo.accdb"
Dim Myid AsString = "Admin"
Dim Mypw AsString = ""
ReportName = Application.StartupPath + "\r1.rpt"
Report.Load(ReportName)
ForEach Connection In Report.DataSourceConnections
OldserverName = Connection.ServerName
OldDatabaseName = Connection.DatabaseName
Report.SetDatabaseLogon(Myid, Mypw)
Report.DataSourceConnections(OldserverName, OldDatabaseName).SetConnection(OldserverName, NewDatabaseName,
True)
Next
CrystalReportViewer1.ReportSource = Report
CrystalReportViewer1.Refresh()