VB中怎样添加新数据到ACCESS

来源:百度知道 编辑:UC知道 时间:2024/06/02 21:24:35
rs.AddNew username = Text1.Text
这样添加记录 哪里错了??
QQ 345324289 可以指导下吗??

rs.Fields(0) = Trim(Text1(0).Text) 浓缩即精华。望采纳

Private Sub Command2_Click()
Dim mu As Integer
If Command2.Caption = "新增" Then
Adodc1.Recordset.MoveLast
nu = Adodc1.Recordset("编号") + 1
Adodc1.Recordset.AddNew
Command2.Caption = "确定"
Command1.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Else
answer = MsgBox("确定要增加该条记录吗?", vbYesNo, "增加记录")
If answer = vbYes Then
Adodc1.Recordset.Update
MsgBox "添加成功!", , "添加记录"
Else
Adodc1.Recordset.CancelUpdate
End If
'Text1.Locked = True
Text2.Locked = True
Text3.Locked = True
Command2.Caption = "新增"
Command1.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
End If
End Sub
-------------------------
参考下~~