数据库常规操作

时间:2022-04-23
本文章向大家介绍数据库常规操作,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
   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();