cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

With Report.ExportOptions

.PDFExportAllPages = True

.FormatType = crEFTPortableDocFormat

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

.DestinationType = crEDTDiskFile

Report.Export False

.ExcelExportAllPages = True

.FormatType = crEFTExcel97

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

Report.Export False

End With

It fails right at the Report.Export line.

Thanks for your help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member292966
Active Contributor
0 Kudos

Hi Glenn,

Is your application logging the report onto the database? My guess is it isn't. It fails on the export line because the engine is trying to execute the report and can't because it's failing on the connection.

Seeing as it runs in Crystal and you can validate the Stored Procedure itself, have a closer look at the application to see how the report is logging on.

Good luck,

Brian

Former Member
0 Kudos

Hey Brian,

I'm not sure what you mean by logging the report onto the database.

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)

Then log the report (which may be what you mean)

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.

Your thoughts?

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

It seems that you are having issue with Crystal reports SDK's.

Post your question in [Crystal Reports .NET SDK forum|;.

That forum is monitored by qualified technicians and you will get a faster response there. Also, all SDK queries remain in one place and thus can be easily searched in one place.

Thank you for your understanding,

Amit

Former Member
0 Kudos

I moved this to Crystal Legacy SDK. It is using VB6 which of course is not .NET.

Brian,

You were close the answer. I had to change the setLogOnInfo to connectproperties. That solved it.

Thanks.