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

database connection from dll

Status
Not open for further replies.

susuke

Technical User
Jul 22, 2002
17
0
0
HU
Hi!

I want ot create functions in a dll (in bcb5), to use datas from a database with ODBC connection.

How can i do this?

I try to create a data module inside a dll, and create a TDatabase object, and the dll was compiled succesful, but when i tried to call the dll function (it creates and closes an ODBC connection only) from a program was created with c++ builder 5, an error message appeared:

"Acces violation on ...."

Please help me to solve this problem.

Thanx
 
Instead of using a data module have you:
1) tried dropping the db component right on the dll form, or
2) tried creating a virutal connection via new, delete?

I'm not that familar with DLL's. Sorry.

James P. Cottingham
-----------------------------------------
[sup]To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.[/sup]
 
if you are not familiar with creating dll go through the
online help in builder and do the dll create example. then go to google and do a search for creating dll.

you have to pass the data from the dll to your app.
I dont know if you can pass handles and such. I would use the dll to handle the opening and closing of the database and all data retrieval. then I would use wrapper functions
to transmit the individual records to the app.

this could be cumbersome if you are trying to populate a
stringgrid, but if you only need one record at a time the
individual records could be parsed and delivered as character arrays.



tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top