Skip to Content
0
Former Member
Mar 27, 2009 at 01:08 PM

VB6 app getting Database Vendor Code: 17 - failed to open connection

36 Views

Hello,

I am trying to run an application that generates a report which was written in VB6. The report was written in Crystal Reports 11.0. It worked well on the old server.

We got a new server. Loaded SQL Server 2005. The boss had to buy Crystal Reports 11.5. We have tried to run the report, but it is failing. I can open the report in the Designer. We are using "sa" in the connection string.

The report is built on a stored procedure. I logged into SQL Server with the sa account and was able to run the stored procedure. I've checked to make sure the path is valid. The credentials are being passed by an ini file and that checks out.

I'm not sure what else to look at.

We first open a connection:

Dim sConn As String

sConn = "PROVIDER=MSDASQL;driver={SQL Server};server=" & gstrDBSERVER _

& ";uid=" & gstrUSERID & ";pwd=" & gstrPASSWORD & ";database=" & gstrDBNAME & ";"

Set gobjConnection = New ADODB.Connection

gobjConnection.Open sConn

(doesn't error, so it looks like it is working)

For i = 1 To Report.Database.Tables.Count

Report.Database.Tables(i).SetLogOnInfo _

Chr(34) & gstrDBSERVER & Chr(34), _

Chr(34) & gstrDBNAME & Chr(34), _

Chr(34) & gstrUSERID & Chr(34), _

Chr(34) & gstrPASSWORD & Chr(34)

Next

Then we export the file

With Report.ExportOptions

.PDFExportAllPages = True

.FormatType = crEFTPortableDocFormat

.DiskFileName = strTargetDirectory & "\" & strFilename & "." & "pdf"

.DestinationType = crEDTDiskFile

Report.Export False

end with

I am told this worked with Crystal Reports 11 on the old server. This new server is running Crystal Reports 11.5.

It fails right at the Report.Export line.

Thanks for your help.