try
{
accessConn
Response
//顯示數據庫中的信息
OleDbDataReader reca = accessComm
while(reca
{ //獲取相應數據
dataString += reca[
+ reca[
+
+ reca[
dataString +=
}
reca
Response
accessConn
}
catch(Exception ex)
{
Response
}
}
單擊頁面UpdateData
private void UpdateDataBtn_Click(object sender
{
if(MyID
{
UpdataDBData(MyID
ShowDBData(); //顯示修改後的數據
}
}
private void UpdataDBData(String myID
{ //設置訪問數據庫的連接
string accessString = ACCESSCONNECTIONSTRING
+ Server
//設置更新數據庫的SQL語句
string cmdText =
+
//創建訪問數據庫的連接和Command
OleDbConnection accessConn = new OleDbConnection(accessString);
OleDbCommand accessComm = new OleDbCommand(cmdText
[
From:http://tw.wingwit.com/Article/program/net/201311/15129.html