//存储图片到xml中***************
Stream stream = File.Open("1.jpg", FileMode.Open);
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
DataTable table = new DataTable();
table.Columns.Add(new DataColumn("image", typeof(byte[])));
DataRow row = table.NewRow();
row["image"] = bytes;
table.Rows.Add(row);
DataSet ds = new DataSet();
ds.Tables.Add(table.Copy());
ds.WriteXml("image.xml");
//从xml中获取图片****************
DataSet ds1 = new DataSet();
ds1.ReadXml("image.xml");
byte[] bts = (byte[])ds1.Tables[0].Rows[0]["image"]; 注意这里报错:无法将string转换成byte,这里如何处理呢,并且要把xml中的图片信息读取出来,保存是没有问题了。
我在编写一个wince5.0的程序,想实现把PDA上的一个LIST <STRING>类型的数据序列化为XML,然后在PC上的一个webservice拿到这个XML,转化为Dataset,更新PC上的数据库,我想问怎么把XML传给webservice的呢?
......