Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to Oracle

Status
Not open for further replies.

deulyd

Programmer
Oct 17, 2001
106
CA
Hi all,
I'm a very beginner with Crystal Reports and this may be a simple question to answer. I'm trying to preview a report in the crViewer with this code but everytime it pops up the connection screen to enter my pwd... Is there a way to directly connect to my database without this pop-up?

Thanx

Deulyd

Private Sub Command4_Click()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim CRdb As CRAXDDRT.Database
Dim CRrpt As CRAXDDRT.Report

Set cnn = New ADODB.Connection
cnn.Open "Provider=OraOLEDB.Oracle.1;Password=danielpwd;User ID=daniel;Data Source=Database1;"

' Open the report
Set CRrpt = CRapp.OpenRepor("C:\CRYSTAL_RPTS\user.rpt", 1)


' Set report source and display it in the viewer
crv.ReportSource = CRrpt

crv.ViewReport

End Sub
 
I finally found the answer myself... If it can help anyone...


CRrpt.Database.Tables(1).ConnectionProperties.Item("Provider") = "OraOLEDB.Oracle.1"
CRrpt.Database.Tables(1).ConnectionProperties.Item("data source") = "Database1"
CRrpt.Database.Tables(1).ConnectionProperties.Item("User ID") = "daniel"
CRrpt.Database.Tables(1).ConnectionProperties.Item("Password") = "danielpwd"

This will automatically set the database and get rid of the annoying connection pop-up. Even if you have multiple tables in the report source, you only have to set connection for the first table. Other tables will use connection of the first one automatically, if not defined.
 
how to connect acces through crystal reports 8.5version in visualbasic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top