数据库常规操作

   string a="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\data.mdb;Persist Security Info=False;";
   OleDbConnection cn=new OleDbConnection(a);
// OleCommand cm=new OleDbCommand("select * from petro_well",cn);
   cn.Open();
  
   //dataset操作
   OleDbDataAdapter ad =new  OleDbDataAdapter ("select * from petro_well",cn);
   DataSet ds=new DataSet();
   ad.Fill(ds,"petro_well");
   //MessageBox.Show (ds.Tables[0].Columns[1].Caption );

  //命令
   //OleDbCommand cm=new OleDbCommand("insert into test (a,b) values(\"jjj\",\"kkk\")",cn);
   OleDbCommand cm=new OleDbCommand("update test set a=\"3\"",cn);
   cm.ExecuteNonQuery();

posted @ 2005-05-01 13:25  jetz  阅读(465)  评论(0编辑  收藏  举报