I am fairly new to VB.NET.
I am struggling to to get my head around
how to connect to a database and update the fields once a button is
clicked.
I am using Visual Studio 2010 and Access 2010.
Any help would be much appreciated.
Below is the current code I have
Code:
Dim conn As New System.Data.OleDb.OleDbConnection()
Dim cmd As New System.Data.OleDb.OleDbCommand()
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & _
"C:\Users\Jonathan\Desktop\BeechSports.accdb"
cmd.CommandText = "INSERT INTO Register (First_Name)" & _
" Values (" & Me.txtFirstName.Text & "')"
Try
conn.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show("Failed to connect to data source: " & vbLf & ex.Message)
Finally
conn.Close()
End Try