In this post you can learned how to insert Delete update search data using MS access with Vb.Net
Imports System.Data.OleDb
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim sqlconn As New OleDb.OleDbConnection
Dim sqlquery As New OleDb.OleDbCommand
Dim connString As String
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\My PC\Documents\Database6.accdb"
sqlconn.ConnectionString = connString
sqlquery.Connection = sqlconn
sqlconn.Open()
sqlquery.CommandText = "INSERT INTO Table1(ID,Name) VALUES (@ID,@Name)"
sqlquery.Parameters.AddWithValue("@ID", TextBox1.Text)
sqlquery.Parameters.AddWithValue("@Name", TextBox2.Text)
sqlquery.ExecuteNonQuery()
sqlconn.Close()
MsgBox("success")
End Sub
End Class
Post a Comment