delphi 报错,我不会改啊!修改密码代码

unit xs_Chpass;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;

type
TChpass = class(TForm)
ADOQuery1: TADOQuery;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Chpass: TChpass;

implementation

uses xs_main;

{$R *.dfm}

procedure TChpass.Button2Click(Sender: TObject);
begin
close;
end;

procedure TChpass.Button1Click(Sender: TObject);
begin
AdoQuery1.Close;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Text:='select * from denglu_xinxi where user_id='+Inttostr(main.main user_id);

AdoQuery1.open;
if edit3.text<>edit2.text then
begin
application.MessageBox('您输入的密码不匹配,请重新输入!','系统提示',16);
edit2.Clear;
edit3.clear;
edit2.setfocus;
end
else if edit1.text<>AdoQuery1.Fieldbyname('password').asstring then
application.MessageBox('旧密码不正确!','系统提示',16)
else
begin
AdoQuery1.edit;
AdoQuery1.fieldvalues'password':=trim(edit2.text);
AdoQuery1.postl;
application.MessageBox('修改成功!','系统提示',32);
close
end
end;

procedure TChpass.FormCreate(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit1.SetFocus;
adoquery1.Connection:=main.ADOConnection1;
end;

end.
报的错误是

[Error] xs_Chpass.pas(47): Undeclared identifier: 'main'
[Error] xs_Chpass.pas(47): 'END' expected but ')' found
[Error] xs_Chpass.pas(50): ';' expected but 'IF' found
[Error] xs_Chpass.pas(53): Undeclared identifier: 'edit2'
[Error] xs_Chpass.pas(54): Undeclared identifier: 'edit3'
[Error] xs_Chpass.pas(55): Missing operator or semicolon
[Error] xs_Chpass.pas(57): '.' expected but 'ELSE' found
[Error] xs_Chpass.pas(60): Identifier redeclared: 'Finalization'
[Error] xs_Chpass.pas(61): Undeclared identifier: 'AdoQuery1'
[Error] xs_Chpass.pas(62): Missing operator or semicolon
[Error] xs_Chpass.pas(62): Missing operator or semicolon
[Error] xs_Chpass.pas(62): There is no overloaded version of 'Trim' that can be called with these arguments
[Error] xs_Chpass.pas(63): Missing operator or semicolon
[Error] xs_Chpass.pas(66): '(' expected but 'END' found
[Warning] xs_Chpass.pas(67): Text after final 'END.' - ignored by compiler
[Error] xs_Chpass.pas(22): Unsatisfied forward or external declaration: 'TChpass.FormCreate'
[Fatal Error] Project1.dpr(7): Could not compile used unit 'E:\学生管理体统\gongcheng\zhuchuangti\xs_Chpass.pas'
麻烦详细些好吗?我才学两三天,不太懂吔!谢谢了,(*^__^*)

那些错误我看得懂,但是它报的不合理啊,明明有分号,报缺少分号!
还有,edit2那些的需要标识吗?

[Error] xs_Chpass.pas(47): Undeclared identifier: 'main' //main未标识
[Error] xs_Chpass.pas(47): 'END' expected but ')' found //多了一个“)”
[Error] xs_Chpass.pas(50): ';' expected but 'IF' found //仔细检查“IF”和“END”,看是否配套,应该是多了一个
[Error] xs_Chpass.pas(53): Undeclared identifier: 'edit2' //edit2未标识
[Error] xs_Chpass.pas(54): Undeclared identifier: 'edit3'//edit3未标识
[Error] xs_Chpass.pas(55): Missing operator or semicolon //分号丢失
[Error] xs_Chpass.pas(57): '.' expected but 'ELSE' found //else的语法错误
[Error] xs_Chpass.pas(60): Identifier redeclared: 'Finalization'
[Error] xs_Chpass.pas(61): Undeclared identifier: 'AdoQuery1'
[Error] xs_Chpass.pas(62): Missing operator or semicolon
[Error] xs_Chpass.pas(62): Missing operator or semicolon
[Error] xs_Chpass.pas(62): There is no overloaded version of 'Trim' that can be called with these arguments
[Error] xs_Chpass.pas(63): Missing operator or semicolon
[Error] xs_Chpass.pas(66): '(' expected but 'END' found
[Warning] xs_Chpass.pas(67): Text after final 'END.' - ignored by compiler
[Error] xs_Chpass.pas(22): Unsatisfied forward or external declaration: 'TChpass.FormCreate'
[Fatal Error] Project1.dpr(7): Could not compile used unit 'E:\学生管理体统\gongcheng\zhuchuangti\xs_Chpass.pas'
自己慢慢查找吧,都是写基本错误
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-05-09
缺少单元引用
相似回答
大家正在搜