I m new to tcp client server applications in c#. I want to pass data table from server to client over the network (between 2 pc's). Plz help by giving me some reference.

有帮助吗?

解决方案

You need to do two different things:

  1. Set up a working tcp server and client. There are lots of tutorials for this task, e.g. http://tech.pro/tutorial/704/csharp-tutorial-simple-threaded-tcp-server

  2. Serialize the data table to send it over network, convert the serialized data to a byte array (Convert class). How to serialize a DataTable to a string?

其他提示

There are may ways to achieve this. You need to know what you are working with (which you have not put in your question).

If it's SQL Server, Oracle, DB2, MySQL or any other RDMBS, then there are lots of examples you can search for using Google ("how to query a table in MSSQL").

If your server is a proprietary setup, then you need to tell us what that that setup is, specifically.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top