Link to home
Start Free TrialLog in
Avatar of cojo1976
cojo1976

asked on

Accessing a MSSQL Server via ODBC in VB6

I have a VB6 app developed that calls an embedded Crystal 8.5 report.  The report is set to use a System DSN via RDO to access a MSSQL server.  The report and app work fine on the development machine.  I installed the app to a second machine that will need to access a different database than the one that was used to write the report.  When I call the report, I receive a "Database Error" message that contains no further information.  Then after accepting that message, the "Server has not yet been opened" error message comes up.  I can save the embedded report as an rpt file and it runs fine on both machines.  I have even renamed the db on the second machine to match the original and reset the ODBC driver but still get the same message.  Any ideas or suggestions are appreciated.  Thanks
Avatar of Chess
Chess

How are you passing the connection information to the report?  It would help if you post your code.
Avatar of cojo1976

ASKER

I assume that my problem is that my very limited understanding of this control(first time I have tried to integrate CR into VB) was that the crystal control handled that and it did not have to be coded.  However, I have since tried setlogoninfo and logonserver.  When I use the setlogoninfo method the report returns the message "MSRDO20.DLL" "37000 [Microsoft][ODBC SQL Server Driver][SQL Server] The cursor was not declared."  Followed by "Error detected by Database dll."  

Here is the setlogoninfo code that I used.

Dim Report As New CrystalReport1
Private Sub Form_Load()
Report.Database.Tables(1).SetLogOnInfo "ODBC", "", "user", "pwd"
Report.Database.Verify

I get the same message even if I put the db name in.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Chess
Chess

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This solution does accomplish the end result of opening the report from within the VB application, however it does not explain how to do it using the embedded report designer.  Thanks for you help on getting this working, I just wish I knew why it didn't work the other way.