我现在有一个修改密码的窗体,有三个textbox,textbox1用来判断登陆的窗体的密码,我写了也下的代码,
if (textbox2.text!=textbox3.text)
{
MessageBox.show("两次输入不一致");
}
else
{
string upda="update xuesheng set password='"textbox2.text"'where password='"textbox3.text"'";
sqlcommand da=new sqlcommand(upda,sqlconnection);
da.connection.open();
da,executenonquery();
MessageBox.show("更新成功");
{
我现在就不明白我要怎样写那个判断的代码的啊,谢谢了!!!!
if (textbox2.text!=textbox3.text)
{
MessageBox.show("两次输入不一致");
}
else
{
string upda="update xuesheng set password='"textbox2.text"'where password='"textbox3.text"'";
sqlcommand da=new sqlcommand(upda,sqlconnection);
da.connection.open();
da,executenonquery();
MessageBox.show("更新成功");
{
我现在就不明白我要怎样写那个判断的代码的啊,谢谢了!!!!
{
return true;
}
else
{
return false;
}
当 这个textbox2.text等于或属于A时,为真,否则为假
change:
string upda="update xuesheng set password='"textbox2.text"'where password='"textbox3.text"'";with:
string upda = "update xuesheng set password='" + textbox2.text + "'where password='" + textbox3.text +"'";
{
return true;
}
else
{
return false;
}
当 这个textbox2.text等于或属于 textbox3.text时,为真,否则为假
string upda="update xuesheng set password='"textbox2.text"'where password='"textbox3.text"'"; 你这句话是当textbox3.text的内容等于数据库中所存储的密码时更改密码。你应该啊按用户号来查的
string upda="update xuesheng set password='"textbox2.text"'where 用户号='"用户.text"'"; 这样才对
你可以在这个winform中写个构造函数把用户名调入
private string name;
public Form1(string str)
{
InitializeComponent();
name = str ;
}
这样你在其他地方登陆的时候用
Form1 f = new (s);
s 为登陆时的用户名;
这样你就可以用查询语句判断密码是否正确了====CSDN 小助手 V2.5 2005年11月05日发布====
CSDN小助手是一款脱离浏览器也可以访问Csdn论坛的软件
界面:http://blog.csdn.net/Qqwwee_Com/archive/2005/11/05/523395.aspx
下载:http://szlawbook.com/csdnv2