Having trouble updating access database.
-
I am writing a program that updates a access database. I am filling a dataset with data from a comma delimited text file. Then I insert the dataset into the database with this piece of code.
OleDbAdapter.Update(dataSet1, "Table1");
This works great, but I also need to insert records to the database using a SQL insert statement. I am using the code below to insert a single record to the database.
"insert into Table1(col1, col2, col3)"
+ " values ('" + textBox1.Text + "', '"
+ textBox2.Text + "', '"
+ textBox3.Text + "')";This works great. The problem comes in when I try to insert another dataset. The correct number of records are added but every row is the same as the row from the SQL statement. I bound the dataset to a datagrid but the datagrid shows the correct data in each row. Please help me before I get fired. Thanks