04-15-2004, 10:20 PM
I would like to connect to various databases like MySQL, SQLServer, Oracle, MS-Access, DB2 etc.,. using VB6.0 as the front end. Is there any way out, to do dynamic connection & get data from the tables & display it in MS-Flexigrid. Pls help me out.
04-15-2004, 10:34 PM
what do you mean by "doing dynamic connection"?
If you want to have multiple connection strings and probably change them in the future, you could store all of them in an INI file so that you could change them without recompiling your application (IF thats what you want to do)
04-15-2004, 10:46 PM
The user can have any type of database. When the user opens the VB application he should be able to select the type of database (for eg: MS_Access, SqlServer, Sybase, Oracle, DB2 etc.,) Once he selects he should be able to connect to that particular database. Once the connection is established....i should be able to retreive the values of the particular table.
04-15-2004, 10:56 PM
do some conditional statements in ur code...
If User Selects ACCESS
set connection string to ACCESS
else if User Selects ORACLE
set connection string to ORACLE
i suggest you store all connection strings on an INI file... so that when you open a connection, you could just call the connection string that you set...
this works if all DB have the same structure
04-16-2004, 06:21 AM
Just use ADO. You can connect to almost every database engine out there via an ADO connection String. Then, you can prompt the user at first to select their database location and database file. Then, you can analyze the selection and determine what database engine it is. Then, you can build your connectionString on the fly and connect.
For a good resource on ADO and connectionstrings:
04-16-2004, 08:38 AM
everyone talks about making an ini file. How do you that? I only know how to make a .txt file and load it up using:
Open file1 & "database.txt" For Input As #lFile
Input #lFile, connection string
Is there any difference with an .ini file and the above?
Thanks for any help
04-16-2004, 06:39 PM
Well there are several potential methods for making an ini file. Review the File I/O tutorial. But, if this ini file is only going to contain text values, just treat it like any other Text file.
Open "C:\Testing.ini" For Append As #lFile
Print #lFile, "my first value"