|
-
Jul 20th, 2004, 12:44 AM
#1
Thread Starter
Member
How To Avoid Connection Info Dialog ?
Hello Everybody :
I want to connect a recordset returned from an sql stored procedure to CR8.5. I am using CRViewer control in vb. But when I run the application it always displays the OLE DB(ADO) connection information dialog box to get the details for sqlserver, username and pwd. The CR is designed using the More Data Sources - Active Data - ConnectionString [ Not DSN ]
Following is the code that i am using.
Dim con As New Connection
Dim rs As New Recordset
Dim crxapp As New CRAXDDRT.Application
Dim crxreport As New CRAXDDRT.Report
Dim cmd As New Command
Private Sub Form_Load()
Set crxreport = crxapp.OpenReport("C:\Test.rpt")
con.ConnectionString = "provider=sqloledb;data source=development;database=TestDB;uid=user1;pwd=abc"
con.Open
cmd.ActiveConnection = con
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "MyProc"
cmd.Parameters.Append cmd.CreateParameter("@DRIVER_ID", adInteger, adParamInput)
cmd.Parameters("@DRIVER_ID") = 2021029
Set rs = cmd.Execute
crxreport.DiscardSavedData
crxreport.Database.SetDataSource rs, 3, 1
CRViewer1.ReportSource = crxreport
CRViewer1.ViewReport
Me.WindowState = vbMaximized
CRViewer1.Zoom 100
End Sub
And if I try using a recordset that is not returned from a stored procedure then it does not ask for any connection information. It works perfectly as expected.
Thanks for any help in anticipation.
- Marjo.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|