delphi连接SQL修改密码的空间有哪些?
追问:修改密码源代码怎么写?在哪个事件里?为什么我写的这个unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;type
TForm3 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
Label4: TLabel;
Edit4: TEdit;
ADOQuery1: TADOQuery;
ADOConnection1: TADOConnection;
DataSource1: TDataSource;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form3: TForm3;implementation
uses Unit1;
{$R *.dfm}
procedure TForm3.Button1Click(Sender: TObject);
begin
with adoquery1 do
begin
close;
sql.clear;
sql.add('select * from 用户 where 用户名 = '''+ edit1.text +''' and 密码= '''+ edit2.text +'''');
open;
end;
if not adoquery1.eof then
begin
if edit3.text = edit4.text then
begin
adoquery1.edit;
adoquery1.FieldByName('密码').AsString:= edit3.text;
adoquery1.SQl.Add('update 用户 set (密码AsString)='''+edit3.Text+'''');
adoquery1.post;
showmessage('修改成功');
end
else if edit3.text <> edit4.text then
showmessage('两次新密码不一致');
end
else
showmessage('用户名或原密码错误');end;
end.
为什么只执行showmessage('用户名或原密码错误');这一句?