From: Thomas <ja...@ma...> - 2004-05-08 22:21:33
|
Hi I have loaded all data from a database table into a dataSet, and stored = this dataSet to a xml file using the WriteXml method. Then I deleted all the data in the database table. Now I would like to read the xml file into a dataSet, and insert the = rows from the dataSet into the table in the database. The code gives no error, but there are not insert any data into the = table... FbConnection connection =3D = FirebirdUtilities.FirebirdConnection.Instance.MyConnection; FbDataAdapter dataAdapter =3D new FbDataAdapter(); FbTransaction transaction =3D connection.BeginTransaction(); dataAdapter.SelectCommand =3D new FbCommand("SELECT * FROM = SYSTEMSETTINGS", connection, transaction); FbCommandBuilder commandBuilder =3D new FbCommandBuilder(dataAdapter); System.Data.DataSet dataSet; dataSet =3D new System.Data.DataSet("SYSTEMSETTINGS ");=20 dataSet.ReadXml(savePath);=20 dataAdapter.Fill(dataSet,"SYSTEMSETTINGS "); dataAdapter.InsertCommand =3D commandBuilder.GetInsertCommand(); dataAdapter.Update(dataSet, "SYSTEMSETTINGS ");=20 transaction.Commit();=20 Can anyone see the error? Thanks Regards Thomas ******** Tables definitions *********** CREATE TABLE SYSTEMSETTINGS ( ID INTEGER NOT NULL, VALUE1 INTEGER, VALUELONG DOUBLE PRECISION); *********** XML FILE *************** <?xml version=3D"1.0" standalone=3D"yes" ?>=20 - <SYSTEMSETTINGS> - <Table> <ID>1</ID>=20 <VALUE1>0</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>2</ID>=20 <VALUE1>25</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>3</ID>=20 <VALUE1>4</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>4</ID>=20 <VALUE1>5</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>5</ID>=20 <VALUE1>1</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>6</ID>=20 <VALUE1>3</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>8</ID>=20 <VALUE1>0</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>9</ID>=20 <VALUE1>1</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>10</ID>=20 <VALUE1>2</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>7</ID>=20 <VALUE1>0</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> - <Table> <ID>13</ID>=20 <VALUE1>0</VALUE1>=20 <VALUELONG>0</VALUELONG>=20 </Table> </SYSTEMSETTINGS> |