在VB中参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突
PrivateSubCommand1_Click()DimusernameAsStringDimuserpasswordAsStringDimtry_timesAsInt...
Private Sub Command1_Click()
Dim username As String
Dim userpassword As String
Dim try_times As Integer
try_times = 0
username = Trim$(Text1.Text)
userpassword = Trim$(Text2.Text)
If Text1.Text = "" Then
MsgBox " 请输入你的姓名!", , "信息提示"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox " 请输入你的密码!", , "信息提示"
Text1.SetFocus
Exit Sub
End If
Dim str As New ADODB.Recordset
Set str = New ADODB.Recordset
str.CursorLocation = adUseClient
str.Open strsql, conn, adOpenStatic, adLockReadOnly
With str
If .State = adStateOpen Then .Close
.Open strsql
If .EOF Then
try_times = try_times + 1
If try_times = 3 Then
MsgBox "密码输入错误超过3次,请联系系统管理员!", , "信息提醒"
Unload Me
Else
MsgBox "对不起,用户名不存在或密码不正确!", , "信息提醒"
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
End If
Else
Unload Me
登录主界面.Show
End If
End With
End Sub
在VB中运行提示到参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突,请问怎么写啊?各位大神求帮忙 展开
Dim username As String
Dim userpassword As String
Dim try_times As Integer
try_times = 0
username = Trim$(Text1.Text)
userpassword = Trim$(Text2.Text)
If Text1.Text = "" Then
MsgBox " 请输入你的姓名!", , "信息提示"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox " 请输入你的密码!", , "信息提示"
Text1.SetFocus
Exit Sub
End If
Dim str As New ADODB.Recordset
Set str = New ADODB.Recordset
str.CursorLocation = adUseClient
str.Open strsql, conn, adOpenStatic, adLockReadOnly
With str
If .State = adStateOpen Then .Close
.Open strsql
If .EOF Then
try_times = try_times + 1
If try_times = 3 Then
MsgBox "密码输入错误超过3次,请联系系统管理员!", , "信息提醒"
Unload Me
Else
MsgBox "对不起,用户名不存在或密码不正确!", , "信息提醒"
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
End If
Else
Unload Me
登录主界面.Show
End If
End With
End Sub
在VB中运行提示到参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突,请问怎么写啊?各位大神求帮忙 展开
3个回答
展开全部
str.Open strsql, conn, adOpenStatic, adLockReadOnly '这里str已经打开
With str
If .State = adStateOpen Then .Close
.Open strsql ‘'这里重复打开str,而且OPEN后参数不全,错误信息应该是这一行出现滴
If .EOF Then
try_times = try_times + 1
With str
If .State = adStateOpen Then .Close
.Open strsql ‘'这里重复打开str,而且OPEN后参数不全,错误信息应该是这一行出现滴
If .EOF Then
try_times = try_times + 1
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
除LS指出的错误外,还包含
Dim str As New ADODB.Recordset
Set str = New ADODB.Recordset
重复了。
Dim str As New ADODB.Recordset
Set str = New ADODB.Recordset
重复了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询