cancel
Showing results for 
Search instead for 
Did you mean: 

change sql driver in vb code

Former Member
0 Kudos

I have vb code setup to login using the following

Dim objReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument

objReport.Load(reportname)

objReport.SetDatabaseLogon("xxx", "xxx", "xxx", "xx", True)

When we call the report from our ERP system all is fine, when I call it from VB I get the login failed message. If I go change the report from ODBC to OLEDB the VB code works but our ERP system then gets the login failed.

How do I change the driver in VB so I can use the same report from both systems?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

FYI, if you are using Business One there is no work around except to manually change the reports data source from one B1 Source to the new B1 source. There is no set of API's in the B1 DB driver that Cr for VS .NET can access.

And likely the cause is the third property of SetDatabaseLogon() is the Server Name, for a report based on ODBC this would be the DSN name you are using in the report and not the IP or SQL Server Name.

Don

Answers (1)

Answers (1)

daniel_paulsen
Employee
Employee
0 Kudos

Hi Richard,

You cannot directly change the Database Provider when using a ReportDocument object.
To do this, you will need to use an ISCDReportClientDocument object. You can access this with something like:

Dim rcd as ISCDReportClientDocument

rcd = objReport.ReportClientDocument.

The "rcd" object model will allow you to change the database provider using either the SetTableLocation method or ReplaceConnection method.

There is a utility you can download that will write out the source code needed (in vb and C#) to change the database information. You can find this utility here:
https://launchpad.support.sap.com/#/notes/1553921

Dan