改密码页面有4个textbox和一个按钮控件,分别是要求输入用户名,旧密码,新密码及确认新密码。
改密码页面有4个textbox和一个按钮控件,分别是要求输入用户名,旧密码,新密码及确认新密码的和一个提交按钮的。请高手帮我我想想提交按钮中的代码怎么写,急,先谢谢哥哥姐...
改密码页面有4个textbox和一个按钮控件,分别是要求输入用户名,旧密码,新密码及确认新密码的和一个提交按钮的。请高手帮我我想想提交按钮中的代码怎么写,急,先谢谢哥哥姐姐弟弟妹妹们了!~~~
展开
4个回答
展开全部
Dim conn As New ADODB.Connection
Dim rs_sysmod As New ADODB.Recordset
Dim connstr As String
Dim sql As String
Private Sub Command1_Click()
if text4.text = "" then
msgbox "请输入登录账号",48
text4.setfocus
exit sub
end if
If Text1.Text = "" Then
MsgBox "请输入原密码", 48
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "请输入新密码", 48
Text2.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "请再次输入新密码", 48
Text3.SetFocus
Exit Sub
End If
If Text2.Text <> Text3.Text Then
MsgBox "两次输入密码不一致!请重新输入。", 48
Text3.SetFocus
Exit Sub
End If
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\xxx.mdb;Persist Security Info=False"
conn.ConnectionString = connstr
conn.Open connstr
rs_sysmod.CursorLocation = adUseClient
sql = "select * from 操作员信息表 where 工号='" & Trim(text4.text) & "'"
rs_sysmod.Open sql, conn, adOpenKeyset, adLockPessimistic
if rs_sysmod.eof = true then
msgbox "未找到改登录账号,请核对", 48
text4.setfocus
rs_sysmod.Close
conn.Close
exit sub
else
If rs_sysmod.Fields("密码") = Text1.Text Then
rs_sysmod.Fields("密码") = Text2.Text
rs_sysmod.Update
rs_sysmod.Close
conn.Close
MsgBox "密码已修改!", 48
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Else
MsgBox "原密码错误!", 48
Text1.SetFocus
rs_sysmod.Close
conn.Close
End If
end if
End Sub
Dim rs_sysmod As New ADODB.Recordset
Dim connstr As String
Dim sql As String
Private Sub Command1_Click()
if text4.text = "" then
msgbox "请输入登录账号",48
text4.setfocus
exit sub
end if
If Text1.Text = "" Then
MsgBox "请输入原密码", 48
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "请输入新密码", 48
Text2.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "请再次输入新密码", 48
Text3.SetFocus
Exit Sub
End If
If Text2.Text <> Text3.Text Then
MsgBox "两次输入密码不一致!请重新输入。", 48
Text3.SetFocus
Exit Sub
End If
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\xxx.mdb;Persist Security Info=False"
conn.ConnectionString = connstr
conn.Open connstr
rs_sysmod.CursorLocation = adUseClient
sql = "select * from 操作员信息表 where 工号='" & Trim(text4.text) & "'"
rs_sysmod.Open sql, conn, adOpenKeyset, adLockPessimistic
if rs_sysmod.eof = true then
msgbox "未找到改登录账号,请核对", 48
text4.setfocus
rs_sysmod.Close
conn.Close
exit sub
else
If rs_sysmod.Fields("密码") = Text1.Text Then
rs_sysmod.Fields("密码") = Text2.Text
rs_sysmod.Update
rs_sysmod.Close
conn.Close
MsgBox "密码已修改!", 48
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Else
MsgBox "原密码错误!", 48
Text1.SetFocus
rs_sysmod.Close
conn.Close
End If
end if
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
string oldPass = txtOldPass.Text;
//编写SQL语句,查询用户的密码
string sqlSel = "select userPass from 用户信息表 where userName='" + Session["userName"]+"'";
//判读用户输入的密码是否正确
if (oldPass == operateData.getTier(sqlSel))
{
//获取新密码
string newPass = txtNewPass.Text;
//编写SQL语句,修改用户的密码
string sqlSet = "update 用户信息表 set userPass='" + newPass + "' where userName='" + Session["userName"] + "'";
//调用公共类中execSql方法执行SQL语句
operateData.execSql(sqlSet);
RegisterStartupScript("", "<script>alert('修改成功!')</script>");
}
else
{
RegisterStartupScript("", "<script>alert('原始密码不正确')</script>");
}
顺便说下 我的链接数据库语句封装在operatedata里面了,方便多次调用
//编写SQL语句,查询用户的密码
string sqlSel = "select userPass from 用户信息表 where userName='" + Session["userName"]+"'";
//判读用户输入的密码是否正确
if (oldPass == operateData.getTier(sqlSel))
{
//获取新密码
string newPass = txtNewPass.Text;
//编写SQL语句,修改用户的密码
string sqlSet = "update 用户信息表 set userPass='" + newPass + "' where userName='" + Session["userName"] + "'";
//调用公共类中execSql方法执行SQL语句
operateData.execSql(sqlSet);
RegisterStartupScript("", "<script>alert('修改成功!')</script>");
}
else
{
RegisterStartupScript("", "<script>alert('原始密码不正确')</script>");
}
顺便说下 我的链接数据库语句封装在operatedata里面了,方便多次调用
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我只能给你提供一些思路 具体代码不会写
这个流程是判断用户名 密码两个字段是否为空,是否跟数据库的值一样
这个流程是判断用户名 密码两个字段是否为空,是否跟数据库的值一样
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询