hi, Can anybody help me on inserting a record in to msaccess database using visualbasic.The record entries are made in the form. Thanks in advance.
A:
I've not got 2008 but here's one way to do it using 2005:
' Open connection to db
Dim connection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TestDB.mdb;")
connection.Open()
' Create a command to execute
Dim command = New OleDbCommand("INSERT INTO TestTable VALUES (100, 'MyName');", connection)
' Execute SQL
command.ExecuteReader()
' Close the connection
connection.Close()
You'll have to get the values from the form and put them into the INSERT SQL statement.
It all depends on how you want to connect to the database. ODBC, ADO, etc.
I've used SQL to manipulate the data. If you need help on that then you can look here: http://www.w3schools.com/sql/default.asp
Matt_JD
2010-08-25 09:04:09