VB6 App with CR9 problem
Recently whenever I call a CR9 report from a VB6 app, I am getting the 'Set datasource dialog box up', asking me to select OLEdB SQL Server, SQL Server dB, password, username and database. This I do not want to happen.
The way I do this is as follows, I create a recordset and execute and assign a stored procedure to the recordset, then pass the recordset to CR
Set gRst = New ADODB.Recordset
Set gRst = fnExecuteSP(spName)"
Set crxReport = crxApp.OpenReport(App.Path & "\CRname.rpt")
crxReport.Database.SetDataSource gRst, 3, 1
With crViewer9
.Visible = True
.ReportSource = crxReport
.ViewReport
.Zoom 1
End With
This has always worked fine, though at this point â.ReportSource = crxReportâ I am getting the set datasource dialog box from CR.
My question is how can I get rid of the dialog and CR to stop prompting the users to select oleDB datasource and entering all the server information?. Is it the way I setup the CR report initially?
I connect to SQL Server with the following.
Public Function fnExecuteSP(strSP As String) As ADODB.Recordset
Set gCmd = New ADODB.Command
With gCmd
'.ActiveConnection = "Provider=SQLOLEDB.1;" _
& "Persist Security Info=False;" _
& "User ID=xgjkhx;" _
& "Password=dhkjshk;" _
& "Initial Catalog=databaseName;" _
& "Data Source=serverName"
.CommandType = adCmdStoredProc
.CommandText = strSP
Set fnExecuteSP = .Execute
End With
End Function
Regards
Ian
|