2010年7月29日 星期四

VB.net AccessUpdate多個欄位的語法出錯問題

更新一個欄位,變數不加上[],不會出問題
sql = "Update [1request] Set Warrantsn='" & MyC & "' where DocNo='" & Glo_Oid & "'"
'MsgBox(sql)
cmd = New OleDbCommand(sql, conn) '誇號裡的第一個是SQL的字串,第二個是資料庫的聯結=OleDbConnection


若有多個參數需要更新,記得每個欄位要加上[]
sql = "Update [2request_Record] Set [aleFound]='" & Sv(2) & "', [id]='" & Sv(3) & "', [mac]='" & Sv(4) & "', [msisdn]='" & Sv(5) & "', [user]='" & Sv(6) & "', [Palesn]='" & Sv(7) & "' where [Record_Seq]='" & Sv(1) & "'"

沒有留言:

張貼留言

追蹤者