ASP.NET连接Access数据库代码
2012-03-28 16:17
423 查看
using System.Data.OleDb;
string ConnStr ="Provider=Microsoft.ACE.OleDb.12.0;Data source=" +@"D:\web\App_Data\db1.accdb";
OleDbConnection oleConnection =
new OleDbConnection(ConnStr);
oleConnection.Open();
OleDbCommand mycommand =
new OleDbCommand("select * from tUser where uname='" + UserName.Text+"' and upwd='" + Password.Text + "'", oleConnection);
int count = Convert.ToInt32(mycommand.ExecuteScalar());
if (count > 0)
{
Session["UserLoginID"] = Login1.UserName;
Response.Redirect("Default.aspx");
}
oleConnection.Close();
string ConnStr ="Provider=Microsoft.ACE.OleDb.12.0;Data source=" +@"D:\web\App_Data\db1.accdb";
OleDbConnection oleConnection =
new OleDbConnection(ConnStr);
oleConnection.Open();
OleDbCommand mycommand =
new OleDbCommand("select * from tUser where uname='" + UserName.Text+"' and upwd='" + Password.Text + "'", oleConnection);
int count = Convert.ToInt32(mycommand.ExecuteScalar());
if (count > 0)
{
Session["UserLoginID"] = Login1.UserName;
Response.Redirect("Default.aspx");
}
oleConnection.Close();
相关文章推荐
- ASP.net 连接Access数据库的相关实例
- winfrom asp.net连接Access数据库
- ASP.net连接Excel的代码
- asp.net连接sql2005,cs文件里直接书写的代码,纯手工操作,不在web.config里面进行配置。
- ASP.NET 连接ACCESS数据库的简单方法
- winfrom、asp.net连接access数据库
- Asp.net连接Access数据库相对路径写法
- asp.net(vb)与sql的连接(代码写在web.config中的)
- Asp.net 连接MySQL的实现代码[]
- asp.net 连接access数据库
- ASP.NET连接 Access数据库的几种方法
- Asp.net_连接Access数据库
- asp连接access数据库代码
- asp.net连接多种数据库的代码
- asp.net连接access数据库实例
- ASP.NET 连接ACCESS数据库
- 在ASP.NET项目中的web.config文件里配置数据库连接并在程序代码中获取连接字符串
- asp.net连接Access数据库例子
- asp.net 项目连接SQL数据库详解代码(类)
- ASP.NET 连接 ACCESS 数据库的代码