March 31st, 2008, 04:40 AM
How can I use OLEDB in VB6.0 directly without ADODB
Currently I am using ADODB for connect with the database, and Recordset to add and update in database, i want to use OLEDB to interact with the database in VB6.0. How I can use OLEDB in VB6.0 for connection and updating the database from my Application. I do not want to use ADODB.
ADODB work with the help of OLDDB from the behind but this time i want to use it directly
Even i do not will it is possible or not.
Please help me out its very argent for me.
Thanks in advance.
Last edited by mishra_sunil22; April 1st, 2008 at 06:46 AM.
March 31st, 2008, 05:28 AM
Re: How to use OLEDB in VB6.0
I wish I had my VB installed but the system just crashed, here is some code to start you off.
Place this code in a module
Then you need to access a form, say a login to add more users, etc. To access the database table, use this code write this code in the form;
Public Cnn As ADODB.Connection
Public Rs As ADODB.Recordset
Public MyDbPath As String
Public Sub ConnectToDatabase()
Set Cn = New ADODB.Connection
Cnn.Provider = "Microsoft.Jet.OLEDB.4.0;Jet OLEDB"
Set Rs = New ADODB.Recordset
Rs.Open "Login", Cnn, adOpenDynamic, adLockOptimistic, adCmdTable
'this should open a table named Login in the database
If it doesn't work then I missed a step somewhere in the form. A coleague will help, am sure.
WITH rsLogin ' This is the login table
.AddNew 'Adds new data to the table
!Password = txtPassword.Text ' Password field in table
!UserName = txtUserName.Text
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.