[我的ASP.net学习历程]数据库操作之(二)

来源: 作者: 2007-12-01 出处:pcdog.com

qq  数据库  数据库操作  

  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();

  }


更多内容请看PCdog.com--.NET与数据库  ASP.NET应用篇  ASP.NET与数据库专题
上一篇:[我的ASP.net学习历程]数据库操作(一)
下一篇:[无聊日记]今天把过去学ASP.net的程序日志贴了上来