c# - Upload XML file by Web Service -


i trying upload xml file local drive through soap web service, , saved sql 2008 r2 database. data type of column xml. below xml in file.

<?xml version="1.0" encoding="utf-8"?> -<dataresult>    -<unit>        <serialno>359815604755374</serialno>        <savedtime>20130723113546</savedtime>        <result>pass</result>        <message/>    </unit> </dataresult> 

i need save xml file sql database. because have submit xml file our customer reference.

what method should use in order achieve goal? can use xml serialization , deserialization?

i design web method accept string of xml text. can use string directly in sql insert command.

public string uploadxml(string xmlstring) {   using (var connection = new sqlconnection(myconnectionstring)) {     using (var command = connection.createcommand()) {       command.commandtext = "insert mytable (xmlcolumn) values (@xmltext)";       command.parameters.addwithvalue("@xmltext", xmlstring);       // etc.     }   } } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -