public static void FriendInfoUpdate(FriendInfo info)
{
string connStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=|DataDirectory|data.mdb";
string SQLcmd = "update FriendInfo set Age='" + info.Age + "' Height='" + info.Height + "' Weight='" + info.Weight + "' Money='" + info.Money + "' where ID='" +info.ID + "';"; ;
OleDbConnection conn = new OleDbConnection(connStr);
conn.Open();
OleDbCommand OleCmd = new OleDbCommand(SQLcmd, conn); //执行SQL命令
conn.Close();
}
多个字段应该是 update 表(字段1, 字段2, ...) values(值1, 值2, ...) where ...
而且你没有执行,要加上 OleCmd.ExecuteNoQuery()才执行。
string SQLcmd = "update FriendInfo set Age='" + info.Age + ",' Height='" + info.Height + ",' Weight='" + info.Weight + ",' Money='" + info.Money + "' where ID='" +info.ID + "';"; ;
OleCmd.ExecuteNoQuery()
没有执行语句:
OleCmd.ExecuteNoQuery()