且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Asp.Net 2.0网站中的搜索功能

更新时间:2023-02-25 09:17:19

确定!

1.创建一个ASP.NET网站
2.创建一个新的搜索页面(ASPX)
3.现在,在此搜索页面中,放置一个文本框,按钮&数据网格
4.在按钮单击事件中,获取在文本框中输入的文本.使用文本形成搜索查询,您将运行数据库以获取结果
5.从数据库检索到数据后,请使用该数据集/数据表并将其绑定到datagrid进行显示.

试试吧!

要使用代码与数据库连接,请尝试使用ADO.NET.看看此处 [
Sure!

1. Create a ASP.NET website
2. Create a new search page(ASPX)
3. Now, in this search page, place a textbox, button & a datagrid
4. In button click event, fetch the text entered in the textbox. Use the text to form a search query that you will run ion the database to get back result
5. Once data retrieved from DB, use that dataset/datatable and bind it to datagrid for display.

Try!

For connection with DB using code, try ADO.NET. have a look here[^] for it.