cancel
Showing results for 
Search instead for 
Did you mean: 

VB6 Crystal 8 run time error 20534 "error detected by database dll"

Former Member
0 Kudos

Help! I've inherited a VB6 that launches a Crystal report from within; it is using Crystal 8.

The error I'm getting is "Run time error 20534, Error detected by database dll". When I step through in the debugger, the offending line in the VB code is the ".Action=1" command that I understand actually executes the report.

From what I read online, the 20534 error is mostly a generic crystal message that covers a variety of things. For the database dll message, most things point to a problem in the query the report is running. Here's the problem - I can open and run the report in report designer just fine. No problems at all. In fact, I can debug the VB, and while it's sitting at the .Action line erroring out, I can open the .rpt file and run it and it pulls the current data I'm expecting.

What the heck do I try next? Other crystal reports work on the same server that this is running from, and reinstalling crystal isn't really an option. Is there a DLL I can try and reregister? Is there something else to try? Thanks much for ANY ideas or help!

Accepted Solutions (1)

Accepted Solutions (1)

former_member292966
Active Contributor
0 Kudos

Hi,

I am so glad the OCX is no longer used in the newer versions. It was simple to use but a pain to troubleshoot.

1) Is your application logging the report onto the database? See if it's using LogonServer or SetNthTableLogon methods. This is the most common reason for this problem. If the database has moved and the report isn't able to logon, you'll get this error.

2) If you open the report in Crystal and point it to the current database, does the report give a message about the database changing? If it does, go to Database | Verify on Every Print and resave the report.

3) What database are you using?

Good luck,

Brian

Former Member
0 Kudos

Thanks for the tips! Sorry about not including the database, I'm connecting to a SQL Server 2000 instance. I'm not sure how the application is logging in, I'll have to check tomorrow when I get in. I want to say it's using LogonServer...actually, now that I think about it it's doing something like:

With CrystalReportObject

.Connection = "whatever the connection string is supposed to be...it matches the dev docs"

.Action=1

End

When I open up the report by itself in Report Designer, it doesn't say anything at all about the database having changed. I've manually verified the database, resaved the report, etc. It's soooo strange.

Former Member
0 Kudos

Ok, it looks like it was using LogonServer, but that is commented out. It is running the report now via:

With CrystalReport1

.ReportFileName = ExecFileLocation & "REPORT.rpt"

.Destination = crptToPrinter

.Formulas(0) = "report_heading=""" & TXTFIELDHEADING & """"

.Connect = "DSN=" & Trim(sServerName) & ";UID=username;PWD=password;DSQ=databasename"

.Action = 1

End With

And this way of doing things works a number of times throughout the rest of the app - it just seems to be a problem with this report. But yeah, if I step through, at the point where it errors I can open the report by itself and execute it without any problems. It doesn't complain about a bad query, or needing to verify the database, or anything.

Any other ideas?

former_member292966
Active Contributor
0 Kudos

Hi,

So all other reports work with the Connect property.

Open the report in Crystal and go to Database | Set Location. Can you verify the database and username used in this report are the same as one of the other reports in the program?

I'm guessing the logon required for this report may be different than the others.

Try running the report in Crystal with the same logon parameters as the Connect is using.

Good luck,

Brian

Former Member
0 Kudos

Yeah, the logins are all the same. When I run the report by itself, it's got the exact same connection info that's being passed to it from VB.

I just don't get it. Can a report become corrupted where it won't run from the VB api?

Another oddity:

This report pulls from a table that is populated from an input text file that the VB app uses. So basically the VB app loads a text file into SQL, then calls the Crystal report to report on the data. When I was testing, it was taking too long with the test file so I truncated it so there were a smaller number of records. (!!) That made me think that there was perhaps a size limit on the crystal report, or bad data or something. But then why can I run the report by itself from outside of VB, calling the same datatable and everything??

Is there anything I can do to "reset" the report or something if it's messed up, but maybe not showing when running from within the VB app?

0 Kudos

I've seen it where setting some parts of report objects in code will cause the report to become corrupt. There is no fix for courrupt reports other than re-building the report. And sometimes not setting all of the variables in an API will cause issues also.

Are you verifying the database in your app, or testing connectivity? Try setting the Mapping event in the viewer control and to pop up a message box. Set Mapping to Prompt mode, this way CR Field Mapping UI will appear if for some reason our field mapping is having a problem at run time.

It may be that for some reason at runtime your DB dependencies are not found. Try connecting to the DB directly and some other table other than your. Use Pubs or the sample database to test and see if that throws any errors.

Open the repor tin CR Designer and preview it. Now save it with data or export it to a new RTP file. Try runnign that in your app. Sometimes this fixes issues....

Thank you

Don

Answers (0)