VB.Net code to do data base connection with MS Access 2010
Private Sub btnSave_Click(sender As
System.Object, e As
System.EventArgs) Handles
btnSave.Click
MsgBox("Sure!
Save permanently in database", MsgBoxStyle.Information,
"SAVE")
Dim cnn As OleDbConnection = New OleDbConnection
Dim cmd
As OleDbCommand
= New OleDbCommand
Dim
connString As String
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data
Source = E:\aDB\AtndcDB.accdb"
cnn.ConnectionString = connString
cmd.Connection = cnn
cnn.Open()
cmd.CommandText = "INSERT INTO Attendence ([dat], [totalPresent)" + " VALUES ('" & dt.Text & "','" & lblTotalPresent.Text & "')"
cmd.ExecuteNonQuery()
cnn.Close()
End Sub
Post a Comment
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.