/下面為資料庫資料的讀取
using system.data.oledb
string strdsn="provider=microsoft.jet.oledb.4.0;data source=metest.mdb";
string strsql="select * from developer";
//例項化oledbconnection物件
oledbconnection myconn=new oledbconnection(strdsn);
//例項化oledbcommand物件
oledbcommand mycmd = new oledbcommand(strsql,myconn);
//例項化oledbdatareader物件
oledbdatareader datareader = null;
//鏈結資料庫,讀取資料
trymyconn.open();
datareader = mycmd.executereader();
while(datareader.read())
//datareader["name"],datareader["address"];
catch(exception e)
finally
myconn.close();
//下面為對資料庫的表單進行資料的寫入
using system.data.oledb;
string strdsn = "provider=microsoft.jet.oledb.4.0;data source=metest.mdb";
string strsql = "insert into developer(name, address)values
('newname','newaddress')";
//例項化oledbcommand物件
oledbconnection myconn = new oledbconnection(strdsn);
//例項化oledbcommand物件
oledbcommand mycmd = new oledbcommand(strsql,myconn);
trymyconn.open();
mycmd.executeninquery();
catch(exception e)
finally
myconn.close();
//從dataset中讀取資料庫資料
//讀取列的屬性
C 資料庫讀取和寫入
下面為資料庫資料的讀取 using system.data.oledb string strdsn provider microsoft.jet.oledb.4.0 data source metest.mdb string strsql select from developer 例項化oledb...
C 讀取 修改Oracle資料庫
連線oracle的時候,需要在 nuget 中安裝 oracle.manageddataaccess.dll 讀取oracle的資料 id 配置資訊 data source description address protocol tcp host ip位址 port 埠號 connect data...
資料庫連線,讀取
連線sql server sqlconnection myconnection new sqlconnection persist security info false integrated security sspi database dream server local myconnectio...