简体   繁体   English

无法将System.Xml.XmlNode []转换为System.Byte []

[英]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. 我有一个Web服务正在从其他设备获取数据,我有一个图像数据类型。 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. 我从server-1上的sql-db-1中选择图像数据,然后在server-2 webservice中调用一个Web服务,该服务获取数据并将其保存到server-2上的sql-db-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[] 问题是,当我尝试将图像保存在PC上或将其插入sql-db-2时,出现错误: can not convert System.Xml.XmlNode[] to System.Byte[]

I need to know how to convert data type System.Xml.XmlNode[] to System.Byte[] . 我需要知道如何将数据类型System.Xml.XmlNode[]转换为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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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