This is what i'm currently doing, but what I would like is parse the xml only get phone, cellphone, name & userid.
I'm getting a http stream xml file: sample below
I'm getting a http stream xml file: sample below
Code:
<root>
<bhcontact name="john doe" userid="123">
<address>my address here</address>
<phone>123-456-7890</phone>
<cellphone>123-456-7888</cellphone>
<state>GA</state>
<zip>12345</zip>
</bhcontact>
</root>
DataSet xmlDS = new DataSet();
DataRow dataRow;
DataSet dbDS = new DataSet("contactxml");
xmlDS.ReadXml(new StringReader("XML STRING HERE--see above"));
trcCon.Open();
SqlDataAdapter trcDA = new SqlDataAdapter("Select * from clientcontact where 1=2", trcCon);
trcDA.Fill(dbDS, "contactxml");
foreach(DataRow drow in xmlDS.Tables[0].Rows)
{
dataRow = dbDS.Tables[0].NewRow();
for(int i=1; i <xmlDS.Tables[0].Columns.Count; i++)
{
dataRow[i] = drow[i];
}
dbDS.Tables[0].Rows.Add(dataRow);
SqlCommandBuilder trcCmd = new SqlCommandBuilder(trcDA);
trcDA.Update(dbDS, "contactxml");
trcCon.Close();
Comment