我想从通过ASP.NET连接的Mysql数据库以自己的格式显示数据。 目前我使用MySQLDataGrid以表格格式显示值。使用ASP.NET显示来自Mysql的用户数据
我的代码是
myConnection = New MySqlConnection("server=localhost; user id=root; password=''; database=test; pooling=false;")
strSQL = "SELECT * FROM tablename;"
myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)
myDataSet = New Dataset()
myDataAdapter.Fill(myDataSet, "mytable")
MySQLDataGrid.DataSource = myDataSet
MySQLDataGrid.DataBind()
and asp code is:
<asp:DataGrid id="MySQLDataGrid" runat="server" />
其显示网格格式的所有列。 但我实际上想以HTML表格格式显示一些包含/排除字段。如下所示。
用户名: 城市: 地址: 等等
我可以对如何做到这一点的简单示例代码?