且构网

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

MySQL数据库行仅显示gridview中的某些行

更新时间:2023-10-07 16:35:40

以下是将它绑定到gridview的方法。

 Gridview1.DataSource = datatable; //这个数据库将填充查询结果
Gridview1.DataBind(); //这会将数据绑定到gridview



如果您使用智能标记创建数据源并将其绑定到gridview ,在绑定gridview之前,你将在向导中测试你的查询和连接。



查看此链接,了解OP如何使用来自的数据填充数据表他的查询结果。

点击进击patty wack! [ ^ ]


Hi,

I am trying to find out if there is anyway to show only certain rows from a MySQL database in gridview that will show only what that user inputs and not what other users input. I have try the query SELECT table WHERE user = 'user name' and that won't work.

Thank you

Here is how you would bind it to your gridview.
Gridview1.DataSource = datatable;//this datable would be filled with the results of your query
Gridview1.DataBind();//this binds the data to the gridview


If you are using the smart tags to create datasources and binding it to the gridview, you will have test your query and connection in the wizard before you bind your gridview.

See this link to see how the OP is filling the datatable with the data from his query result.
Click clack patty wack![^]