I always get an invalid INSERT INTO exception
// Create the DataSet object
DataSet oDS = new DataSet();
OleDbConnection conn = new
OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data
Source=domotica 7.mdb");
conn.Open();
// Create the DataTable
OleDbDataAdapte r oOrdersDataAdap ter = new OleDbDataAdapte r(new
OleDbCommand("S ELECT * FROM InOut", conn));
OleDbCommandBui lder oOrdersCmdBuild er = new
OleDbCommandBui lder(oOrdersDat aAdapter);
oOrdersDataAdap ter.FillSchema( oDS, SchemaType.Sour ce);
DataTable pTable = oDS.Tables["Table"];
pTable.TableNam e = "InOut";
// Insert the Data
DataRow oOrderRow = oDS.Tables["InOut"].NewRow();
oOrderRow["Modulenaam "]="testmodule ";
oOrderRow["Omschrijvi ng"] = "informatie ";
oOrderRow["SubAdres"] = 123;
oOrderRow["Zone"] = "badkamer";
oDS.Tables["InOut"].Rows.Add(oOrde rRow);
//this fails
oOrdersDataAdap ter.Update(oDS, "inout");
conn.Close();
"Miki Watts" <mi*****@netvis ion.net.il> wrote in message
news:KM******** ************@gi ganews.com...
"Sagaert Johan" <RE************ *@hotmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. I need some example
I have a dataset populeted through a dataadapter fill method
i can add rows to my dataset , but i have an exception when calling the
dataadpters update method.
I already spent 7 hours to solve this, yet i still am no step further.
I might be missing something around the Updatecommand property of the
oleDBDataAdapte r.
Can someone point me to an example or more information ?
There are two things i can think of (at least, that i ran into them
myself): 1. You have an autonumber column in the table, but the MissingSchemaAc tion
property in the data adapter is set to Add, but not AddWithKey.
2. Your table comes from a query, so it's not possible to update the
tables that the data came from.
Miki