[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Accessing a MSSQL Server via ODBC in VB6

Posted on 2002-06-14
4
Medium Priority
?
517 Views
Last Modified: 2007-11-27
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
0
Comment
Question by:cojo1976
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Chess
ID: 7079373
How are you passing the connection information to the report?  It would help if you post your code.
0
 

Author Comment

by:cojo1976
ID: 7079460
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
0
 
LVL 1

Accepted Solution

by:
Chess earned 1200 total points
ID: 7083609
Try something like this.  If that does not work, post your code in full.
------------------------------------------------
sreport_name = "rpt_swap_valuation.rpt"
   
    sreport_name = App.Path & "\REPORTS\" & sreport_name
   
    Set crreport = crapplication.OpenReport(sreport_name)
    For i = 1 To crreport.Database.Tables.Count
        crreport.Database.Tables(1).SetLogOnInfo gServerName, gDbName, gLogin, gPassword
        crreport.Database.Tables(1).Location = gDbName & ".dbo." & "Get_Swap_Appraisal"
    Next i
    crreport.ParameterFields(1).AddCurrentValue (sreport_fund_num)
    crreport.ParameterFields(2).AddCurrentValue (CDate(sreport_processingdate))
    crreport.ParameterFields(3).AddCurrentValue (gFundgroupnumber)
    frmReport.rptViewer.ReportSource = crreport

    frmReport.rptViewer.ViewReport
    frmReport.Show
0
 

Author Comment

by:cojo1976
ID: 7090729
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.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question