在C#.net中使用基于textBox.text的查询填充GridView [英] Populating a GridView with query based on textBox.text in C#.net

查看:148
本文介绍了在C#.net中使用基于textBox.text的查询填充GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用基于C#中的textBox.text的查询填充GridView,如果可能的话,请在后面提供我的代码,在此先感谢,并帮助我完成我正在做的业余学校项目,其中提供了一个文本框,并从SQL数据库中获取了值基于textbox.text,我正在执行类似结果页的操作


朋友们请帮我这样做

在此先感谢

UGADI提前让所有成员满意

Populating a GridView with query based on textBox.text in C# and please provide me code behind if possible thanks in advance and help me getiting dis done i am doing hobby school project where a textbox is provided and getting the value from SQL database based on textbox.text and i am doing like result page


friends please help me doing this

thanks in advance

Happy UGADI to all members in advance

推荐答案

首先,这个要求显然不是一个好要求.用户必须非常了解SQL查询,并且应该熟悉表和字段

其次,这里的问题是什么.在将数据检索到数据表或其他数据时,必须使用命令文本中的文本框进行查询.然后将其绑定到GridView.
First the requirement is obviously not a good one. User must be aware of the SQL queries very well and should be familiar with the Tables and fields

Second what is the issue here. You have to use the query from the text box in the commandtext while retrieving the datas to data-table or whatever. Then bind it to the GridView.


无法根据需要学习代码,但是我建议您实现休息的步骤是您的编码能力:

单击提交时,获取textbox.text并将其传递到数据访问层.如果使用的是Web,则在.aspx.cs中完成.如果使用Windows Form.cs

如果要使用连接的体系结构,请在数据访问层中使用SQL命令,Connection,Reader对象来获取数据.否则请使用SQL命令,DataAdapater,Dataset.

将数据集返回到form.cs或aspx.cs.并将datatset.defaultview分配给网格的数据源,然后调用grid.bind()(仅在ASP.NET中).

这会在您的页面/表单上显示数据

这是URLS
http://www.dotnetperls.com/datagridview-tutorial [ http://msdn.microsoft.com/en-us/library/aa479341.aspx [ --WebForms ]

快乐学习:)

也祝你开心的ugadi
Can''t give you the code as you want learn but I can suggest you steps to implement rest is your ability to code:

When submit is clicked get the textbox.text and pass it to dataaccess layer.This is done in .aspx.cs if you are using web.If windows Form.cs

in the data access layer.In the data access layer use SQL command,Connection,Reader objects to fetch data if you want to use connected architecture.Else use SQL command,DataAdapater,Dataset.

Return the dataset to your form.cs or aspx.cs. and assign the datatset.defaultview to the datasource of the grid and call the grid.bind() (in ASP.NET only ).

This displays the data on you page/form

here are the URLS
http://www.dotnetperls.com/datagridview-tutorial[--WinForms]
http://msdn.microsoft.com/en-us/library/aa479341.aspx[--WebForms]

Happy learning :)

Happy ugadi to you too


这篇关于在C#.net中使用基于textBox.text的查询填充GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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