编写VB用ado链接数据库,提示我当前记录集不支持更新,可能是提供程序的限制,也可能是选定锁定类型的限制
下面是我编的代码PrivateSubCommand1_Click()IfText1(1)=""ThenMsgBox"新建用户的密码不得出现‘*’!"Text1(1).Se...
下面是我编的代码
Private Sub Command1_Click()
If Text1(1) = "" Then
MsgBox "新建用户的密码不得出现‘*’!"
Text1(1).SetFocus
Exit Sub
End If
If Text1(7) = "" Then
MsgBox "身份证不得为空!"
Text1(7).SetFocus
Exit Sub
End If
If Text1(9) = "" Then
MsgBox "卡号不得为空!"
Text1(9).SetFocus
Exit Sub
End If
SQL = "select * from READER "
Set rs = New ADODB.Recordset
rs.Open SQL, conn
For j = 1 To MSFlexGrid1.Rows - 1
If MSFlexGrid1.TextMatrix(j, 9) = Text1(9) Then
MsgBox "卡号已经存在,请重新输入!"
Text1(9).SetFocus
Exit Sub
End If
Next
rs!xm = Text1(1)
rs!xb = Text1(2)
rs!ZC = Text1(3)
rs!gw = Text1(4)
rs!dh = Text1(5)
rs!zz = Text1(6)
rs!sfz = Text1(7)
rs!AH = Text1(8)
rs!Kh = Text1(9)
rs!XE = Val(Text1(10))
rs!bz = Text1(11)
rs!zt = "正常"
rs.Update
Call Form_Load
rs.Close
End Sub
在text1这里就停住了,代码还有很多 可以解决的我再发后续代码 有木有高手 展开
Private Sub Command1_Click()
If Text1(1) = "" Then
MsgBox "新建用户的密码不得出现‘*’!"
Text1(1).SetFocus
Exit Sub
End If
If Text1(7) = "" Then
MsgBox "身份证不得为空!"
Text1(7).SetFocus
Exit Sub
End If
If Text1(9) = "" Then
MsgBox "卡号不得为空!"
Text1(9).SetFocus
Exit Sub
End If
SQL = "select * from READER "
Set rs = New ADODB.Recordset
rs.Open SQL, conn
For j = 1 To MSFlexGrid1.Rows - 1
If MSFlexGrid1.TextMatrix(j, 9) = Text1(9) Then
MsgBox "卡号已经存在,请重新输入!"
Text1(9).SetFocus
Exit Sub
End If
Next
rs!xm = Text1(1)
rs!xb = Text1(2)
rs!ZC = Text1(3)
rs!gw = Text1(4)
rs!dh = Text1(5)
rs!zz = Text1(6)
rs!sfz = Text1(7)
rs!AH = Text1(8)
rs!Kh = Text1(9)
rs!XE = Val(Text1(10))
rs!bz = Text1(11)
rs!zt = "正常"
rs.Update
Call Form_Load
rs.Close
End Sub
在text1这里就停住了,代码还有很多 可以解决的我再发后续代码 有木有高手 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询