I have a report (actuall a group of reports) that are calling a SQL Server Stored Procedrue to get the data for the report. The reports were created by someone else, on a different server with a different database name. I have the exact same database, but it is a different name.
If I open the report in crystal reports and change the 'Location' settings to point to my server and database, the report will preview without problems.
However, if I try to do the same thing in code, it does not work. Maybe I am missing something. Here is the code:
o=CREATEOBJECT('crystal.crpe.application')
o.LogOnServer('pdssql.dll','DJ-LAPTOP', 'DEMO', '***', '***')
r=o.OpenReport('reports\registration.rpt')
r.Database.tables(1).setlogoninfo('DJ-LAPTOP', 'DEMO', '***', '***')
r.Database.tables(1).location = 'demo.dbo.proc(cusCRIGetRegistrationForm)'
r.Database.Verify()
r.Preview()
The error I get is on the Preview() method. The message says:
"OLE IDispatch exception code 20534 from cpeaut32: Error detected by database DLL..."
Has anybody done anything like this before? What am I missing?