新手求助
Private Sub Command1_Click()Dim User_sql As String
If Text1.Text <> Empty And Text2.Text <> Empty And Text3.Text <> Empty And Text4.Text <> Empty Then
Set bookdata = OpenDatabase(App.Path + "\97.mdb", False, False)
User_sql = "select * from 人员登录信息表 where 员工工号='" + Text1.Text + "'and 密码='" + Text2.Text + "'"
Set rs1 = bookdata.OpenRecordset(User_sql, dbOpenDynaset) If Text3.Text = Text4.Text Then
If rs1.RecordCount > 0 Then
rs1.Edit
rs1!密码 = Text3.Text
rs1.Update
MsgBox ("恭喜您,您的密码修改成功!请记住您的新密码:" & Text3.Text), vbOKOnly, "系统提示!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text1.SetFocus
Else
MsgBox "帐号或密码不正确,请确认后重新输入!", vbOKOnly, "系统提示!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text1.SetFocus
End If
Else
MsgBox "新密码两次输入不一致,请重新修改!", vbOKOnly, "系统提示!"
Text3.Text = ""
Text4.Text = ""
Text3.SetFocus
End If
Else
MsgBox "以上是必须填写完整的,请填写完整!", vbOKOnly, "系统提示!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text1.SetFocus
End If
End Sub
标准表达式中数据类型不匹配,rs1=空值,求教如何修改?谢谢! 参阅一下这个:
http://download.csdn.net/detail/veron_04/3827200 你打开"立即窗口",然后在程序运行出错停顿时在立即窗口中输入: debug.print User_sql 然后回车,看一下传过去的SQL语句到底是什么
检查一下数据库中员工工号是什么数据格式,如果是数字类型,把select语句中的员工工号的单引号去掉 User_sql = "select * from 人员登录信息表 where 员工工号='" + Text1.Text + "' and 密码='" + Text2.Text + "'"
and前缺少一个空格。
补充:VB , 数据库(包含打印,安装,报表)