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!

crystal not disconnecting from sql 7

Status
Not open for further replies.

thenewdetective

Programmer
Jul 3, 2001
1
US
hello,
i have a vb6 application that accesses a sql 7 database with crystal 7 as the reporting tool.

i'm having a problem with crystal disconnecting from the database.

here's the sequence of events:

(the crystal activex control is on its own form)

1) vb opens the form and passes parameters for the report.
2) crystal creates a connection to the database and prints the report.
3) vb unloads the form

the problem is that, on some systems, the connection that crystal created persists. vb thinks that the form is unloaded and, therefore, the connection is closed. (there is a loop that tests for the existence of the form in the Forms collection) the connection is only closed when the user exits the entire application.

has anybody else seen this? could it be a problem with win95 or old odbc drivers? i have tried every resource and have not found anything.

any help is greatly appreciated. the whole team is waiting on me to fix this before deployment.
 
Unloading a form in VB does not necessarily destroy all of the objects on the form.

Put a Set FormX = Nothing in the Unload event of the Form (where FormX is the name of your form). Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer
 
Even better, create a separate connection for the Crystal reports and destory the connection on the Form Unload event:

Set Connection = Nothing (where Connection is the name of your database connection) Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top