G
geeksgk
Gurus,
Here is what I'm trying to do.
I have a table in sql server. The data for this table comes from a XML
(with matching schema) from an external system. I'm trying to read the
xml into a dataset and then use the sqlDataAdapter.update command to
insert the data into the table.
Here is my source dode and IT DOES NOT INSERT ANY RECORDS AND IT DOES
NOT GIVE ANY ERROR TOO. PLS HELP
string strConnectionString = "conection string goes here";
string SelectQuery = "SELECT PicklistID, PicklistCode, PicklistDesc
FROM temp123";
SqlDataAdapter myDataAdapter = new SqlDataAdapter();
SqlConnection mySQLConnection = new SqlConnection(strConnectionString);
SqlCommand mySQLSelectCommand = new SqlCommand(SelectQuery,
mySQLConnection);
myDataAdapter.SelectCommand = mySQLSelectCommand;
SqlCommandBuilder cmdb = new SqlCommandBuilder(myDataAdapter);
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet);
DataSet NewDataSet = new DataSet();
NewDataSet.ReadXmlSchema("myXmlDocumentSchema.xsd");
NewDataSet.ReadXml("myXmlDocument.xml");
myDataSet.Merge(NewDataSet, true);
myDataAdapter.Update(myDataSet);
What baffles me is that when I run this code IT DOES NOT GIVE ANY ERROR
and also it DOES NOT insert/update or delete any record in the
database.
myXmlDocument.xml has data and it matches the schema of the table.
What's wrong?
Here is what I'm trying to do.
I have a table in sql server. The data for this table comes from a XML
(with matching schema) from an external system. I'm trying to read the
xml into a dataset and then use the sqlDataAdapter.update command to
insert the data into the table.
Here is my source dode and IT DOES NOT INSERT ANY RECORDS AND IT DOES
NOT GIVE ANY ERROR TOO. PLS HELP
string strConnectionString = "conection string goes here";
string SelectQuery = "SELECT PicklistID, PicklistCode, PicklistDesc
FROM temp123";
SqlDataAdapter myDataAdapter = new SqlDataAdapter();
SqlConnection mySQLConnection = new SqlConnection(strConnectionString);
SqlCommand mySQLSelectCommand = new SqlCommand(SelectQuery,
mySQLConnection);
myDataAdapter.SelectCommand = mySQLSelectCommand;
SqlCommandBuilder cmdb = new SqlCommandBuilder(myDataAdapter);
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet);
DataSet NewDataSet = new DataSet();
NewDataSet.ReadXmlSchema("myXmlDocumentSchema.xsd");
NewDataSet.ReadXml("myXmlDocument.xml");
myDataSet.Merge(NewDataSet, true);
myDataAdapter.Update(myDataSet);
What baffles me is that when I run this code IT DOES NOT GIVE ANY ERROR
and also it DOES NOT insert/update or delete any record in the
database.
myXmlDocument.xml has data and it matches the schema of the table.
What's wrong?