首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

vb怎么更新数据库中一条数据

2012-01-24 
vb如何更新数据库中一条数据VB codeDim QueryStr As StringDim Rs As ADODB.RecordsetDim BelongToDay As

vb如何更新数据库中一条数据

VB code
      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


[解决办法]
VB code
'新增记录:conn.execute "insert into 表名(...) values(...)"'修改记录:conn.execute "update 表名 set ... where ..."'删除记录:conn.execute "delte from 表名 where ..."
[解决办法]
先删后加
[解决办法]
探讨
VB code

Dim QueryStr As String
Dim Rs As ADODB.Recordset
Dim BelongToDay As Date
Dim Group As Integer

Set Rs = New ADODB.Recordset
Set Rs.ActiveConn……

热点排行