Update
用途:更新表中原有数据
语法:
Update table_name Set column_name = new_value Where column_name = some_value
例:
“Person”表中的原始数据:
LastName | FirstName | Address | City |
Nilsen | Fred | Kirkegt 56 | Stavanger |
Rasmussen | | Storgt 67 | |
运行下面的SQL将Person表中LastName字段为”Rasmussen”的FirstName更新为”Nina”:
UPDATE Person SET FirstName = 'Nina' WHERE LastName = 'Rasmussen'
更新后”Person”表中的数据为:
LastName | FirstName | Address | City |
Nilsen | Fred | Kirkegt 56 | Stavanger |
Rasmussen | Nina | Storgt 67 | |
同样的,用UPDATE语句也可以同时更新多个字段:
UPDATE Person SET Address = 'Stien 12', City = 'Stavanger' WHERE LastName = 'Rasmussen'
更新后”Person”表中的数据为:
LastName | FirstName | Address | City |
Nilsen | Fred | Kirkegt 56 | Stavanger |
Rasmussen | Nina | Stien 12 | Stavanger |
实例:
EXESQLCommand2("update INFO set 类别='" & lb & "',标题='" & bt & "',标签='" & bq & "',网址1='" & wz1 & "',网址2='" & wz2 & "',网址3='" & wz3 & "',备注=(@BZ),RTF=(@RTF),时间='" & sj & "' where TID=" & idFlag, bz, bjrtf)