下面的代码是用户修改密码的代码。谢谢了!!if Edit1.Text=username then
begin
if Edit2.text=Edit3.Text then
begin
adoQuery1:=TadoQuery.Create(self);
adoQuery1.Connection:=adoConnection1;
adoQuery1.SQL.Clear;
adoQuery1.SQL.Add('update userlist set password=:password where userID=:username');
adoQuery1.Parameters.Clear;
adoQuery1.Parameters.AddParameter;
adoQuery1.Parameters[0].Name:='password';
adoQuery1.Parameters[0].DataType:=ftstring;
adoQuery1.Parameters[0].Direction:=pdinput;
adoQuery1.Parameters[0].Value:=Edit2.Text;
adoQuery1.Parameters.AddParameter;
adoQuery1.Parameters[1].Name:='username';
adoQuery1.Parameters[1].DataType:=ftstring;
adoQuery1.Parameters[1].Direction:=pdinput;
adoQuery1.Parameters[1].Value:=pwd;
adoquery1.ExecSQL;
adoQuery1.Close;
showmessage('sfsf');
end
else
begin
application.MessageBox('两次密码不一致!','提示信息',mb_ok);
Edit2.SetFocus; end;
end
else
begin
application.MessageBox('旧密码错,请重新输入!','提示信息',mb_ok);
Edit1.SetFocus;
end;
begin
if Edit2.text=Edit3.Text then
begin
adoQuery1:=TadoQuery.Create(self);
adoQuery1.Connection:=adoConnection1;
adoQuery1.SQL.Clear;
adoQuery1.SQL.Add('update userlist set password=:password where userID=:username');
adoQuery1.Parameters.Clear;
adoQuery1.Parameters.AddParameter;
adoQuery1.Parameters[0].Name:='password';
adoQuery1.Parameters[0].DataType:=ftstring;
adoQuery1.Parameters[0].Direction:=pdinput;
adoQuery1.Parameters[0].Value:=Edit2.Text;
adoQuery1.Parameters.AddParameter;
adoQuery1.Parameters[1].Name:='username';
adoQuery1.Parameters[1].DataType:=ftstring;
adoQuery1.Parameters[1].Direction:=pdinput;
adoQuery1.Parameters[1].Value:=pwd;
adoquery1.ExecSQL;
adoQuery1.Close;
showmessage('sfsf');
end
else
begin
application.MessageBox('两次密码不一致!','提示信息',mb_ok);
Edit2.SetFocus; end;
end
else
begin
application.MessageBox('旧密码错,请重新输入!','提示信息',mb_ok);
Edit1.SetFocus;
end;
解决方案 »
- borland project group文件如何安装啊?
- float值相减的绝对值精度问题
- image控件显示图片,如何设置按钮对图片进行放大缩小?
- 请问谁知道那里有开源的crm,或者开源网站,国内国外的都成。
- 在Project A 里有FORM A 和FORM B,当打开FORM B或者点FORM B上的某个按钮时,如何判断FORM A有没有打开?
- 报表名次排序问题!解决即给分
- 请教pascal中的静态方法可不可以覆盖?
- 求救一个以业务流程为主的使用手册模板
- 如何屏蔽运行注册表文件时的提示信息
- 软件的版本信息问题,好奇怪哦
- 如何在一个DBGrideh中显示几个查询的内容,谢谢!
- 功能强大的图形控件推荐给大家。和大家一起分享/...
adoQuery1.Parameters.AddParameter;
adoQuery1.Parameters[0].Name:='password';
adoQuery1.Parameters[0].DataType:=ftstring;
adoQuery1.Parameters[0].Direction:=pdinput;
adoQuery1.Parameters[0].Value:=Edit2.Text;
adoQuery1.Parameters.AddParameter;
adoQuery1.Parameters[1].Name:='username';
adoQuery1.Parameters[1].DataType:=ftstring;
adoQuery1.Parameters[1].Direction:=pdinput;
adoQuery1.Parameters[1].Value:=pwd;
改为adoQuery1.Parameters.Parameterbyname('password').value:=Edit2.Text;
adoQuery1.Parameters.Parameterbyname('username').value:=pwd;试试行不行,因为UPDATE语句看起来没问题。
即adoQuery1.Parameters.Parambyname('username').value:=pwd;
adoQuery1.SQL.Add('update userlist set password=:password where userID=:username');
parameters.parambyname('password').value := pwd;//这样写看看,怎么会那么复杂
//.....
adoquery1.ExecSQL;
adoQuery1.SQL.Clear;
adoQuery1.SQL.Add('update userlist set password='''+Edit2.Text+
''' where userID='''+username+'''');
adoquery1.ExecSQL;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
adoQuery1.SQL.Add('update userlist set [password]=:password where [userID]=:username');