vb如何更新数据库中一条数据
Dim QueryStr As String Dim Rs As ADODB.Recordset Dim BelongToDay As Date Dim Group As Integer Set Rs = New ADODB.Recordset Set Rs.ActiveConnection = Conn Rs.CursorType = adOpenKeyset Rs.LockType = adLockOptimistic QueryStr = "SELECT * FROM N_Master " Rs.Open QueryStr With Rs .AddNew .Fields("Product_Number") = lbl_Zong_ProductNum.Caption .Fields("Date_Time") = Date & Time .Update End With
'新增记录:conn.execute "insert into 表名(...) values(...)"'修改记录:conn.execute "update 表名 set ... where ..."'删除记录:conn.execute "delte from 表名 where ..."
[解决办法]
先删后加
[解决办法]