如何使用 ACCESS DB 连接来填充 gridview
如何使用 Access 数据库的连接来填充 GridView
?
到目前为止我有以下代码:
OleDbConnection myConnection = default(OleDbConnection);
OleDbCommand myCommand = default(OleDbCommand);
string strSQL = null;
strSQL = "SELECT * FROM tblLoginInfo " + "WHERE username='" + CustID.Replace("'", "''") + "' " + "AND password='" + CustPass.Replace("'", "''") + "';";
myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " + "Data Source=" + Server.MapPath("login.mdb") + ";");
myCommand = new OleDbCommand(strSQL, myConnection);
myConnection.Open();
但现在怎么办?
How can I populate a GridView
using a connection to an Access Database?
So far I have the following code:
OleDbConnection myConnection = default(OleDbConnection);
OleDbCommand myCommand = default(OleDbCommand);
string strSQL = null;
strSQL = "SELECT * FROM tblLoginInfo " + "WHERE username='" + CustID.Replace("'", "''") + "' " + "AND password='" + CustPass.Replace("'", "''") + "';";
myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " + "Data Source=" + Server.MapPath("login.mdb") + ";");
myCommand = new OleDbCommand(strSQL, myConnection);
myConnection.Open();
But now what ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
类似方法
尝试AccessDataSource、SqlDataSource 以及在 ASP.NET 中连接到 Access 数据库
我还发现了这篇关于 在 Asp.net 中将 GridView 与 MS Access 数据库表绑定
希望这有帮助
Try something like this
as mentioned in AccessDataSource, SqlDataSource and connecting to Access databases in ASP.NET
Also I found this article about Bind GridView with MS Access Database table in Asp.net
Hope this helps