q; no insert

G

Guest

Hello,

I have this code get xml string from web service and I am trying to insert
it into my table in the SQl server through, it does not give any error but it
does not insret the records too, what is problem?

myWS.myDS ds = new myWS.myDS();
myWS.Service ws = new myWS.Service();
System.IO.TextReader tr = new System.IO.StringReader(ws.LoadTable());
ds.ReadXml(tr, XmlReadMode.DiffGram);

daSR.TableMappings.Add("Table", "myTable");
daSR.Update(ds);
 
R

Ray Booysen

JIM.H. said:
Hello,

I have this code get xml string from web service and I am trying to insert
it into my table in the SQl server through, it does not give any error but it
does not insret the records too, what is problem?

myWS.myDS ds = new myWS.myDS();
myWS.Service ws = new myWS.Service();
System.IO.TextReader tr = new System.IO.StringReader(ws.LoadTable());
ds.ReadXml(tr, XmlReadMode.DiffGram);

daSR.TableMappings.Add("Table", "myTable");
daSR.Update(ds);

We're going to need to see the code from the webservice and what the
..LoadTable() method does.
 
G

Guest

Thanks for your help. I do not have a control over web service but they
return dataset via WriteXml. Here is what I am getting when I dump tr to a
string: This is the XML returned by Web service:

<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><pTDS
xmlns="http://tempuri.org/pTDS.xsd"><myTable diffgr:id="myTable1"
msdata:rowOrder="0"
diffgr:hasChanges="inserted"><fNum>1064</fNum><fName>c4</fName><dD>ToDB</dD><dR>Nk</dR><ADT>2006-05-23T09:05:13.843-04:00</ADT><AUN>wssa</AUN></myTable><myTable
diffgr:id="myTable2" msdata:rowOrder="1"
diffgr:hasChanges="inserted"><fNum>1065</fNum><fName>t4</fName><dD>ToDB</dD><dR>Nk</dR><ADT>2006-05-23T09:05:28.687-04:00</ADT><AUN>wssa</AUN></myTable></pTDS></diffgr:diffgram>
 
G

Guest

Thanks for your help.
Here is how I create my adapter:
string sqlStr = "myStoredProcedure";
SqlCommand sqlCmd = new SqlCommand(sqlStr, sqlConn);
sqlCmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter daSR = new SqlDataAdapter(sqlCmd);
SqlCommandBuilder cbSR = new SqlCommandBuilder(daSR);
 
R

Ray Booysen

JIM.H. said:
Thanks for your help.
Here is how I create my adapter:
string sqlStr = "myStoredProcedure";
SqlCommand sqlCmd = new SqlCommand(sqlStr, sqlConn);
sqlCmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter daSR = new SqlDataAdapter(sqlCmd);
SqlCommandBuilder cbSR = new SqlCommandBuilder(daSR);
Where do you open a connection?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top