a_jam_sandwich
Well-known member
Ive not been on for a while (Off work) so happy new year to you all.
Ive started looking at ADO.NET and trying inserting a record into a ACCESS2000 database. The problems.... I what to use datasets as In the software im creating Relationship Links are a nice idea. The following CODE doesnt work with the error;
Syntax error in INSERT INTO statement. Anyone know what im doing wrong???? Also when looking at the SQL in the OleDbCommandBuilder all there is, is ?????????? where the values should be
Cheers Andy.
Ive started looking at ADO.NET and trying inserting a record into a ACCESS2000 database. The problems.... I what to use datasets as In the software im creating Relationship Links are a nice idea. The following CODE doesnt work with the error;
Syntax error in INSERT INTO statement. Anyone know what im doing wrong???? Also when looking at the SQL in the OleDbCommandBuilder all there is, is ?????????? where the values should be
Code:
Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\support.mdb"
Dim SelectString As String = "SELECT * FROM SUPPORT"
Dim MyConn As New OleDbConnection(ConnectionString)
Dim MyAdapter As New OleDbDataAdapter()
MyAdapter.SelectCommand = New OleDbCommand(SelectString, MyConn)
Dim CommandBuilder As OleDbCommandBuilder = New OleDbCommandBuilder(MyAdapter)
Dim MyDataset As New DataSet()
Dim MyTable As New DataTable()
Try
MyConn.Open()
MyAdapter.FillSchema(MyDataset, SchemaType.Source, "Support")
MyAdapter.Fill(MyDataset, "Support")
MyTable = MyDataset.Tables("Support")
Dim MyRow As DataRow = MyTable.NewRow
MyRow(2) = "Mr D"
MyTable.Rows.Add(MyRow)
MsgBox(CommandBuilder.GetInsertCommand.CommandText.ToString)
MyAdapter.Update(MyDataset, "Support")
Catch ex As OleDbException
Console.WriteLine(ex.Message)
End Try
Cheers Andy.