VB Code:
'get a blank new row from the table so it has all the structure
Dim newRow as datarow=ds.Tables(0).NewRow
'fill the row with data
newRow("Field")="Some data goes here"
'now the dataset has the new data but it is disconnected
'so the database itself doesn't so we use a dataadapter to
'update the actual database
'connect to the database
cnn.Open()
da.Update(ds.Tables(0))
cnn.Close()
VB Code:
'build sql statement
Dim sb As New System.Text.StringBuilder()
sb.Append("INSERT INTO MyTable (MyField1,MyField2) VALUES (")
'fill in values
sb.Append(value1 & ",")
sb.Append(value2 & ")")
'make command
Dim cmd As New OleDb.OleDbCommand(sb.ToString, cnn)
'open connection
cnn.Open()
'execute
cmd.ExecuteNonQuery()
cnn.Close()