从多线程客户端服务器套接字中的服务器返回数据表/数据集 [英] Returning datatable/dataset by from server in a Multithread Client server socket

查看:78
本文介绍了从多线程客户端服务器套接字中的服务器返回数据表/数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用客户端服务器套接字编程完成以下4和5号任务?
1.客户端将查询作为常规文本发送到服务器. [我可以做到]
2.服务器从客户端获取SQL. [我可以做到]
3.服务器执行查询(Select语句). [我可以做到]
4.服务器将查询结果作为数据表或数据集返回给客户端[我该如何做]
5.客户端获取数据表或数据集并显示到客户端.[我该怎么做]
请帮助我,我必须尽快提交我的项目

How can I do the following number 4 and 5 task using client server socket programming?
1. Client send a query as regular text to the server. [I can do this]
2. Server get the SQL from the client. [I can do this]
3. Server execute the query(Select statement). [I can do this]
4. Server return the query result as datatable or dataset to the client [How can I do this]
5. Client get the datatable or dataset and display to the client side.[How can I do this]
Please help me guys I have to submit my project very soon

推荐答案

要填充数据集,请查看以下内容:http://msdn.microsoft.com/en-us/library/377a8x4t.aspx [ http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx [ ^ ]
For filling the dataset, have you had a look at this: http://msdn.microsoft.com/en-us/library/377a8x4t.aspx[^]

And for displaying the result, it depends what technology you use (WinForms, WPF, ...) and what requirement you have but for example this control may help you http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx[^]



您需要dataadapter来填充数据集

SqlDataAdapter da =新的SqlDataAdapter(CommandObj,ConnectionObj)
da.fill(ds);

要显示数据,您需要诸如GridView,Repeater,dataList之类的控件

现在您必须将该数据集绑定到gridview或repeater,例如

gridView.DataSource = ds;
gridView.DataBind();
hi
You need dataadapter to fill the dataset

SqlDataAdapter da = new SqlDataAdapter(CommandObj,ConnectionObj)
da.fill(ds);

to diplay the data you need controls like GridView,Repeater,dataList

now you have to bind that dataset to gridview or repeater like

gridView.DataSource= ds;
gridView.DataBind();


这篇关于从多线程客户端服务器套接字中的服务器返回数据表/数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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