S
skneife
I need to use the dataAdapter.Update to update all tables of a
dataset.
Look at the code below, I load my dataset by DataFile.xml and I update
the database by callling dataAdapter.Update(dataSet, "EMPLOYES"). The
xml file contains data for more thatn one table.
But my needs is to upate all Dataset tables.
What is the way for doing this ?
using( SqlConnection cnx = new SqlConnection(sCnx) ) {
using( SqlDataAdapter dataAdapter = new SqlDataAdapter() ) {
DataSet dataSet = new DataSet();
string sCmd = "SELECT * FROM EMPLOYEES";
dataAdapter.SelectCommand = new SqlCommand(sCmd, cnx);
SqlCommandBuilder cmdBuilder = new
SqlCommandBuilder(dataAdapter);
dataSet.ReadXml(@"C:\DataFile.xml");
dataAdapter.Update(dataSet, "EMPLOYES");
}
}
Sam
dataset.
Look at the code below, I load my dataset by DataFile.xml and I update
the database by callling dataAdapter.Update(dataSet, "EMPLOYES"). The
xml file contains data for more thatn one table.
But my needs is to upate all Dataset tables.
What is the way for doing this ?
using( SqlConnection cnx = new SqlConnection(sCnx) ) {
using( SqlDataAdapter dataAdapter = new SqlDataAdapter() ) {
DataSet dataSet = new DataSet();
string sCmd = "SELECT * FROM EMPLOYEES";
dataAdapter.SelectCommand = new SqlCommand(sCmd, cnx);
SqlCommandBuilder cmdBuilder = new
SqlCommandBuilder(dataAdapter);
dataSet.ReadXml(@"C:\DataFile.xml");
dataAdapter.Update(dataSet, "EMPLOYES");
}
}
Sam