i want to start my codng immdiately about linkng the database in vb...but i dnt knw how...anybody there hu would lke to help me hw i can lnk my database...please...tnx guyz.....

which database you are using and what exactly you mean by linking ?

i would like to link the adodb in vb6.0 manually meaning whether you transfr ur file in any drive the location of the database automatically change....

tnx for the reply..i appreciate ur help...

which database you are using ?

i am using the adodc

adodc is a control to connect to the database and is not a database itself.

i mean access...

For VB6.0, i would advice you create your projects and the database file in the C:\ drive. You can create a folder there to save projects so when you move your project folder to another system, the name and directory of the Access Dbase file remains the same.
Having said that, here is the code for MS Access connection:

Option Explicit
Public conn As New ADODB.connection
Public rs As New ADODB.Recordset

Sub connection()
Set conn = New ADODB.connection
conn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\data\DataBaseName.mdb"
End Sub

Try this sample code.

Dim cn As New ADODB.connection
 
cn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\data\DataBaseName.mdb"

cn.BeginTrans
cn.Execute "your insert statement goes here."
cn.CommitTrans

thank u so much sir...it helps a lot...sir can you put a comments on your sample code especially line 5-7 so that i can understand it also...more power and God Bless sir...by the way sir i'll mark it now solve....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.