i have some doubts to connect vb with databse.so anybody help me hw to connect this two.

You can use Data control to connect a database to a project.

can you specify what is your doubt. also post how u r trying to connect vb to database.

Inserting a new record and updating a record using the Execute command in Visual Basic.

We can use the SQL Insert statement to issue a command that will add a new record in a data source.

Option Explicit
Dim CN As Connection
Dim comobj As Command

Private Sub Form_Load()
Set CN = New Connection
Set comobj = New Command

With CN
.ConnectionString = “Integrated Security=SSPI;Initial Catalog=FinAccounting;Data Source=SYS1”
.Provider = “SQLOLEDB”
.Open
End With
With comobj
.ActiveConnection = CN
.CommandText = “INSERT INTO AccountsTable(AccountCode,AccountName,AccountCat) values(‘C001’,’Creditor1',’1')”
.Execute
End With
End Sub

Updating Records

You can use the SQL Update statement to issue a command that changes a record or group of records.

Option Explicit
Dim CN As Connection
Dim comobj As Command

Private Sub Form_Load()
Set CN = New Connection
Set comobj = New Command

With CN
.ConnectionString = “Integrated Security=SSPI;Initial Catalog=FinAccounting;Data Source=SYS1”
.Provider = “SQLOLEDB”
.Open
End With

With comobj
.ActiveConnection = CN
.CommandText = “UPDATE AccountsTable SET AccountName =’Main Creditor1' WHERE AccountCode=’C001'”
.Execute
End With

End Sub

use the adodc component in vb,it is very easy to learn.go to your components and click adodc control and datagrid control to display your data.
hope this helps....

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.