Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Programmatically change OLE DB properties fails

Hello,

I have a crystal report (written in CR 2013 Pro), and a Visual Studio Pro 2013 console application using the CR for VS dlls to simply export the CR as a PDF.  When I hardcode the console application to provide the report the necessary login credentials, the PDF is successfully produced.  When I attempt to pass a variable credential to the same server that the crystal was originally written to connect to, it works.  It's when I try to change the server name and database that it fails.

Below is based off of adding snippets from other questions.  I remarked them out - again - works fine with using same Servername as what I used in CR designer, but it fails on the .VerifyDatabase() when I edit variable ServerName.

With crConnectionInfo

.ServerName = ServerName

.Password = PWord

.UserID = UserID

.DatabaseName = DbName

End With

With customerReport

If (DebugStatementsOnOutput = 1) Then

     returnValue = 3

End If

.Load(reportPath)

If (DebugStatementsOnOutput = 1) Then

     returnValue = 4

End If

.SetDatabaseLogon(UserID, PWord, ServerName, DbName)

'For Each crTable As Table In .Database.Tables

'    .SetDatabaseLogon(UserID, PWord, ServerName, DbName)

'Next

'For Each subReport As ReportDocument In .Subreports

'    For Each crTable As Table In subReport.Database.Tables

'        .SetDatabaseLogon(UserID, PWord, ServerName, DbName)

'    Next

'Next

If (DebugStatementsOnOutput = 1) Then

     returnValue = 41

End If

.VerifyDatabase()

If (DebugStatementsOnOutput = 1) Then

     returnValue = 5

End If

Former Member
replied

Will the report run if you don't verify the database?  Are there any differences at all between the test and prod databases - version of SQL Server, field names or types, table names, indexes, etc?

What version of SQL Server are you connecting to and what version of the SQL Server client are you using? Are you using ODBC or OLEDb to connect?  If it's ODBC, do you have the correct ODBC connections set up ?

What platform are you targeting in your application - 32-bit or 64-bit?  If you're using ODBC, do you have the appropriate "bit-ness" ODBC connections?

-Dell

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question