VB Project Source Code

Vb.net with access Data Base 1







'Interop.ADODB.dll
Imports ADODB

Public Class Form1

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click







        If TextBox1.Text = "" Or TextBox2.Text = "" Then
            MsgBox("Please Enter the value")
            Exit Sub
        End If






        Dim con As ADODB.Connection
        con = New ADODB.Connection







        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=vbdotnetwithaccess.mdb"

        con.Open()















        con.Execute("insert into table1 (name,address) values ('" & TextBox1.Text & "','" & TextBox2.Text & "')")
        con.Close()
        con = Nothing


        TextBox1.Text = ""
        TextBox2.Text = ""

    End Sub
End Class