VB中怎样添加新数据到ACCESS
rs.AddNewusername=Text1.Text这样添加记录哪里错了??QQ345324289可以指导下吗??...
rs.AddNew username = Text1.Text
这样添加记录 哪里错了??
QQ 345324289 可以指导下吗?? 展开
这样添加记录 哪里错了??
QQ 345324289 可以指导下吗?? 展开
2个回答
展开全部
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
-------------------------
参考下~~
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
-------------------------
参考下~~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询