`
happmaoo
  • 浏览: 4347574 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

asp.net学习之二(数据库操作之二)

阅读更多
private void Page_Load(object sender, System.EventArgs e)
{
string dbPath = @"Data\dbTest.mdb";
string db = Server.MapPath(dbPath);
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + db;
//string strSQL = "SELECT * FROM Customers";
//string strSQL = "INSERT INTO Customers(CustomerID) VALUES ('QQQQQ')";
//string strSQL = @"UPDATE Customers SET CustomerID='PPPPP',Address='64651546' WHERE id=11";
//string strSQL = @"DELETE FROM Customers WHERE id = 11";

OleDbConnection conn = new OleDbConnection(connectionString);
OleDbCommand cmd = new OleDbCommand(strSQL,conn);

cmd.Connection.Open();
cmd.ExecuteReader();
conn.Close();

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics