Results 1 to 7 of 7

Thread: [RESOLVED] VB6 and Crystal Reports 8 / 8.5 - Error 20599 - Cannot Open SQL Server.

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2008
    Posts
    23

    Resolved [RESOLVED] VB6 and Crystal Reports 8 / 8.5 - Error 20599 - Cannot Open SQL Server.

    I don't know where else to look or turn at this point... I have googled and read all the articles I could find on this error, followed links and threads from posts I have found, and I am officially stumped!

    I know something like this would normally be asked on a crystal report or reporting specific forum, but SAPs response is always upgrade, and the only active people that seem to still have this knowledge live here in the VB6 forum.

    So move the thread if you must, but I feel it is best served here.

    On to the problem...

    • I have a development machine where the forthcoming code works as expected, but when installing and running on the client machine, it throws the error "20599 - Cannot Open SQL Server".
    • Obviously, this is an environmental issue, and something is different about the client machine, versus the development machine.
    • However, I am unable to determine what that is!



    What I know:
    • I have looked at the runtime.hlp file
    • The report connection configuration has not changed.
    • The development machine has both Crystal Reports 8 and 8.5 installed on it, dont ask me why, but it DOES WORK in development, important to remember.
    • The ODBC System DSN Connections exist as 32bit connections on both machines, are configured the same, are using the same SQL driver and version, and both test successfully.
    • When opening the report in crystal designer, and doing "Convert Database Driver", it lists the PDSODBC.DLL (p2sodbc.dll) as the driver.
    • When doing "Verify Database" it comes back with the database is up to date.
    • The p2sodbc.dll exists on both machines. I have tried putting all relevant files on the client machine in "C:\windows\crystal", "C:\Windows\System32\"; and "C:\Windows\syswow64"
    • Both machines are Windows 10 64bit.
    • Crystal reports viewer inside of vb6 code seems to work from what I have tested (This tells me some parts of Crystal reports are registered correctly and working)
    • Most of the 200,000+ lines of code of this application seem to be working, including older Adobe 5 functions, and tons of other stuff I have had to finagle to get working in Windows 10 environment.


    Here is the code - It is erroring on the PrintReport part:

    Code:
    Private Sub PrintReport()
    
              Dim crApp As New CRAXDRT.Application
              Dim crRpt As Report
              
              Dim objDBSettings As AppSettings
              Set objDBSettings = New AppSettings
    
              frmMain.CrystlRep.Reset
              frmMain.CrystlRep.LastErrorNumber = 0
              frmMain.CrystlRep.LastErrorString = ""
              frmMain.CrystlRep.Destination = crptToPrinter
             'I have tried using both these connection strings, with and without the DSN specified 
             'frmMain.CrystlRep.Connect = "DSN=" & objDBSettings.GetINIValue("Crystal Reports", "DSN") & ";UID=" & objDBSettings.GetDBConnectionVal("Admin_Id") & ";PWD=" & objDBSettings.GetDBAdminPwd & ""
              frmMain.CrystlRep.Connect = "UID=" & objDBSettings.GetDBConnectionVal("Admin_Id") & ";PWD=" & objDBSettings.GetDBAdminPwd & ""
              
              frmMain.CrystlRep.ReportFileName = Dir$ + "test.rpt"
              frmMain.CrystlRep.StoredProcParam(0) = "Test"
              
              Set crRpt = crApp.OpenReport(Dir$ + "test.rpt")
             
              crRpt.EnableParameterPrompting = False
              crRpt.ParameterFields(1).AddCurrentValue "Test"
              crRpt.SelectPrinter Printer.DriverName, Printer.DeviceName, Printer.Port
              frmMain.CrystlRep.PrinterSelect
              frmMain.CrystlRep.PrintReport
    
              If frmMain.CrystlRep.LastErrorNumber Then
                MsgBox "Crystal Report Error #" + CStr(frmMain.CrystlRep.LastErrorNumber) + " --- " + frmMain.CrystlRep.LastErrorString
              End If
    
    End Sub

    EDITED:
    • The "p2sodbc.dll" appears in the development machines registry.
    • The "p2sodbc.dll" DOES NOT appear in the client machines registry.
    • The directory the "p2sodbc.dll" is listed as "C:\windows\system32\" in the development machines registry.
    • However, "p2sodbc.dll" DOES NOT exist in this directory, it exists under "C:\Windows\Crystal".
    • Trying to use "C:\windows\system32\regsvr32.exe" and "c:\windows\syswow64\regsvr32.exe" to register "p2sodbc.dll" results in error saying :it was loaded but entry point dllregisterserver was not found.
    • This error trying to register happens on both dev and client machines.



    Name:  p2sodbc.jpg
Views: 17072
Size:  21.9 KB

    Here are some relevant screenshots:
    Name:  error.png
Views: 16773
Size:  12.2 KB
    Name:  odbc.png
Views: 17295
Size:  77.4 KB
    Name:  convertdbdriver.png
Views: 16528
Size:  19.5 KB
    Name:  verifydb.png
Views: 16483
Size:  10.1 KB


    ANY help is much appreciated. I have exhausted my searches, and need one of those AHA moments desperately!
    Last edited by guht; May 25th, 2018 at 11:07 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width