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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RDC Crystal Reports 2

Status
Not open for further replies.

zivrap

Technical User
Aug 10, 2004
31
CA

Hi,

I have a quick RDC question. Given the following statement..

Code:
report.Database.LogOnServer "p2sodbc.dll", "MyDSN", "MyDatabase", "MyUser",
"MyPWD

How do I use it if I have an access 2000 database located at c:\myDb.mdb ? I've searched online but cant seem to find an example to suit my needs. I am using cr8 and vb 6 pro. Thank you for the help.
 
Hi Guys,

I have tried everything and I still cannot get it to work. I get this strange error message that says "Object 'Database' of 'IReport' Failed" Then, the vb app opens microsoft visual C++ and shows me all this assembly code !! Here is my simple code. It is all in one form.

Code:
Dim crxApplication As New CRAXDRT.Application
Dim report As New CRAXDRT.report

Private Sub cmdPrint_Click()

Set report = crxApplication.OpenReport("C:\myRep.rpt")

CRViewer1.ReportSource = report
CRViewer1.ViewReport

End Sub


Private Sub Form_Load()

report.Database.LogOnServer "p2sodbc.dll", "C:\myDB.mdb"

End Sub

I have tried moving the "report.Database.LogOnServer" line all over the place with no luck. Thank you very much for the help.
 
The second argument of the LogOnServer method should be the name of an ODBC DSN, not a path to a database.

LogOnServer pDllName, pServerName[, pDatabaseName ][, pUserID ][, pPassword ]

If you created the report against an ODBC connection, you need to pass its name as the ServerName argument. The db path would be set up within the DSN.

-dave
 

Hey Vidru,

I dont know how a ODBC DSN name looks like. I just followed the CR wizard when creating the report and made it get data from the access database I created on C: . How do I find the name of the ODBC DSN connection? Thank you for your help.
 
Hmmm... so you created a report, but don't know if you connected using ODBC or not.

Open the report in Crystal. Go to Database > Convert Database Driver. The "From:" section will be grayed out, but it'll at least tell you what database driver was used when you created the report. If it's something other than pdsodbc.dll or p2sodbc.dll, that means you're not using an ODBC connection.

Once you've got the name of the correct .dll, you can try passing it as the first arg. of the LogOnServer method, and see if that works. Otherwise, post back which .dll it's using, and we'll go from there.

-dave
 


Hi,

In the grayed out part it says pdsodbc.dll[ODBC] .
 

Hey Vidru,

I just tied something else. Instead of using ODBC I tried OLE DB . This way my code worked without having to log on at all. what is the diff between ole db and odbc ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top