vb 链接sql的修改密码
我想做一个修改密码的界面,很简单的姓名,密码,新秘密,验证密码,就在放入数据库是总是语法不对,希望高手看看,给改正一下DimrsAsNewRecordsetDimsqls...
我想做一个修改密码的界面,很简单的姓名,密码,新秘密,验证密码,就在放入数据库是总是语法不对,希望高手看看,给改正一下
Dim rs As New Recordset
Dim sqlstr As String
Dim mydata As Recordset
Dim user, pass As String
user = Text1.Text
pass = Text2.Text
sqlstr = "select * from 用户表 where 姓名='" & user & "'"
Set rs = New Recordset
rs.Open sqlstr, cnn, adOpenStatic, 1
If rs.RecordCount > 0 Then
If pass <> rs("密码") Then
MsgBox "原始密码不正确"
Else
If Text4.Text = Text3.Text Then
sqlstr = "update 用户表 set 密码='" & Text3.Text & "'"
sqlstr.Update
'mydata (sqlstr)
MsgBox "密码修改正确"
Unload Me
Else
MsgBox "两次输入的密码不一致"
End If
End If
End If
rs.Close
Set rs = Nothing 展开
Dim rs As New Recordset
Dim sqlstr As String
Dim mydata As Recordset
Dim user, pass As String
user = Text1.Text
pass = Text2.Text
sqlstr = "select * from 用户表 where 姓名='" & user & "'"
Set rs = New Recordset
rs.Open sqlstr, cnn, adOpenStatic, 1
If rs.RecordCount > 0 Then
If pass <> rs("密码") Then
MsgBox "原始密码不正确"
Else
If Text4.Text = Text3.Text Then
sqlstr = "update 用户表 set 密码='" & Text3.Text & "'"
sqlstr.Update
'mydata (sqlstr)
MsgBox "密码修改正确"
Unload Me
Else
MsgBox "两次输入的密码不一致"
End If
End If
End If
rs.Close
Set rs = Nothing 展开
1个回答
展开全部
Dim rs As New Recordset
Dim sqlstr As String
Dim mydata As Recordset
Dim user, pass As String
user = Text1.Text
pass = Text2.Text
sqlstr = "select * from 用户表 where 姓名='" & user & "'"
rs.Open sqlstr, cnn, adOpenStatic, 1
If rs.RecordCount > 0 Then
If pass <> rs("密码") Then
MsgBox "原始密码不正确"
Else
If Text4.Text = Text3.Text Then
sqlstr = "update 用户表 set 密码='" & Text3.Text & "'"
cnn.execute sqlstr
'mydata (sqlstr)
MsgBox "密码修改正确"
Unload Me
Else
MsgBox "两次输入的密码不一致"
End If
End If
End If
rs.Close
Set rs = Nothing
Dim sqlstr As String
Dim mydata As Recordset
Dim user, pass As String
user = Text1.Text
pass = Text2.Text
sqlstr = "select * from 用户表 where 姓名='" & user & "'"
rs.Open sqlstr, cnn, adOpenStatic, 1
If rs.RecordCount > 0 Then
If pass <> rs("密码") Then
MsgBox "原始密码不正确"
Else
If Text4.Text = Text3.Text Then
sqlstr = "update 用户表 set 密码='" & Text3.Text & "'"
cnn.execute sqlstr
'mydata (sqlstr)
MsgBox "密码修改正确"
Unload Me
Else
MsgBox "两次输入的密码不一致"
End If
End If
End If
rs.Close
Set rs = Nothing
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询