简体   繁体   中英

Can't convert System.Xml.XmlNode[] to System.Byte[]

I have a web service that is getting data from onther device I have an image data type. I select the image data from sql-db-1 on server-1 then call a web service in server-2 webservice that takes the data and saves it into sql-db-2 on server-2.

The problem is that when I'm trying to save the image on the pc or insert it into sql-db-2 I get an error: can not convert System.Xml.XmlNode[] to System.Byte[]

I need to know how to convert data type System.Xml.XmlNode[] to System.Byte[] .

I dont know what kind of data is there in the Node. But i think somthing similar like this might do:

    var item = xmlnode[0];
    Byte[] byteconverted = Encoding.UTF8.GetBytes(item.InnerText)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM