通过套接字将数据集对象作为字符串传递 [英] passing dataset object as a string through socket

查看:77
本文介绍了通过套接字将数据集对象作为字符串传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个客户端服务器应用程序,在该应用程序中,我需要通过套接字将服务器上的数据集对象发送到客户端.
我想将该数据集对象作为字符串传递给客户端&然后在客户端将字符串转换回数据集对象,以便我可以将其与datagrid一起使用.

任何帮助或建议都将受到欢迎.

I am working on a client server application in which I need to send the dataset set object from server to the client through socket.
I want to pass that dataset object as string to the client & then on the client side convert the string back into dataset object so that I can use it with datagrid.

Any help or suggestion would definitely be welcomed

推荐答案

我三天前对您回答了: ^ ]

您的问题是什么,因为您的问题与上次没有什么不同?
I answered this three days ago, to you: converting a dataset object into string & passing it through socket[^]

What is your problem with it, since your question is no different to last time?


我想将该数据集对象作为字符串传递给客户端&然后在客户端将字符串转换回数据集对象
如果您已经注意到,数据集将遵循定义的XML格式.可以轻松地将其转换为XML(可以轻松地将其作为字符串传递),然后将该XML重新转换回数据集.试试吧.
I want to pass that dataset object as string to the client & then on the client side convert the string back into dataset object
If you have noticed, dataset follows a defined XML format. One can easily convert the same into XML (which can easily be passed as a string) and then re-convert back that XML into dataset. Try out.


串行化是您的朋友,看看DataSet WriteXML ReadXML 方法

这样您就可以将数据集转换为字符串

摘自有关eggheadcafe的文章 [ http://weblogs.asp.net/skoganti/archive/2004/08/30/222525.aspx [ ^ ]

然后,您应该能够通过另一端反序列化的套接字发送数据集

谷歌搜索"DataSet binaryformatter"以获取有关此主题的更多信息
Serialization is your friend here, have a look at the DataSet WriteXML and ReadXML methods

That will let you convert your dataset into a string

From an article on eggheadcafe[^]...

Now developers who''ve worked with Binary Serialization know that the ADO.NET DataSet describes itself to the Serialization Framework only in XML. You run a DataSet through the BinaryFormatter and what you get is a very large byte array filled with -- you guessed it -- a whole glop full of textual XML!

So, make sure you set your dataset formatting to Binary

http://weblogs.asp.net/skoganti/archive/2004/08/30/222525.aspx[^]

You should then be able to send your dataset over sockets are deserialize at the other end

Have a google for ''DataSet binaryformatter'' for more information on this subject


这篇关于通过套接字将数据集对象作为字符串传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆