Q&A

  • [급함]왜 에러가 나는지...
unit Unit1;



interface



uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

StdCtrls, ExtCtrls, DBCtrls, Buttons, ComCtrls, Db, ADODB, Grids, DBGrids,

Mask;



type

TForm1 = class(TForm)

PageControl1: TPageControl;

TabSheet3: TTabSheet;

Label40: TLabel;

Label41: TLabel;

Label28: TLabel;

Label29: TLabel;

Label30: TLabel;

Label31: TLabel;

Label32: TLabel;

Label33: TLabel;

Label34: TLabel;

Label35: TLabel;

Label36: TLabel;

Label37: TLabel;

Label38: TLabel;

Label39: TLabel;

Label42: TLabel;

Label43: TLabel;

edit1: TEdit;

edit2: TEdit;

edit3: TEdit;

edit4: TEdit;

edit5: TEdit;

edit6: TEdit;

edit7: TEdit;

edit8: TEdit;

edit9: TEdit;

edit10: TEdit;

edit11: TEdit;

ydb: TDBGrid;

insert: TBitBtn;

BitBtn19: TBitBtn;

BitBtn20: TBitBtn;

BitBtn21: TBitBtn;

BitBtn22: TBitBtn;

Button2: TButton;

Button3: TButton;

BitBtn18: TBitBtn;

BitBtn24: TBitBtn;

eidt12: TEdit;

procedure FormCreate(Sender: TObject);

procedure insertClick(Sender: TObject);

procedure BitBtn18Click(Sender: TObject);

procedure BitBtn20Click(Sender: TObject);

procedure edit1Change(Sender: TObject);

procedure BitBtn24Click(Sender: TObject);

procedure BitBtn22Click(Sender: TObject);



private



=============================================================================

ADOQuery1 : TADOQuery;



=> 이 부분에서 에러



[Hint] Unit1.pas(63): Private symbol 'sState' declared but never used

============================================================================





===========================================================================

curDir, sState, idNum, idNum2, yState : String;



=> 이 부분에서 에러



[Hint] Unit1.pas(63): Private symbol 'sState' declared but never used

============================================================================





============================================================================

ds, sds, yds : TDataSource;





=> 이 부분에서 에러



[Hint] Unit1.pas(64): Private symbol 'ds' declared but never used

=============================================================================





==============================================================================

sQuery : TADOQuery;





=> 이 부분에서 에러



[Hint] Unit1.pas(65): Private symbol 'sQuery' declared but never used



===============================================================================









procedure clearEditBox;

procedure ySetting;



================================================================================

procedure noEdit;



=> 이 부분에서 에러



[Hint] Unit1.pas(69): Private symbol 'noEdit' declared but never used



===============================================================================

procedure returnDefault;

{ Private declarations }

public

{ Public declarations }

end;



var

Form1: TForm1;



implementation



{$R *.DFM}





procedure TForm1.FormCreate(Sender: TObject);

var

conStr : String;

yQuery : TADOQuery;



begin



// 연봉관리를 위한 코딩................

yds := TDataSource.Create(self);

yQuery := TADOQuery.Create(self);



conStr := 'Provider=Microsoft.Jet.OLEDB.4.0;Data ';

conStr := conStr + 'Source='+curDir+'dbFilemoney.mdb;Persist ';

conStr := conStr + 'Security Info=False';

yQuery.ConnectionString := conStr;



yQuery.Close;

yQuery.SQL.Clear;

yQuery.SQL.Add('select * from year1');

yQuery.Open;

yds.DataSet := yQuery;

ydb.DataSource := yds;

yds.DataSet.Open;



yState := '';

returnDefault;

BitBtn20.Enabled := false;



=================================================================================

Edit12.Visible := false;



end;





procedure TForm1.BitBtn22Click(Sender: TObject);

begin

self.Close;

end;



procedure TForm1.clearEditBox();

begin



Edit1.Text := '';

Edit2.Text := '';

Edit3.Text := '';

Edit4.Text := '';

Edit5.Text := '';

Edit6.Text := '';

Edit7.Text := '';

Edit8.Text := '';

Edit9.Text := '';

Edit10.Text := '';

Edit11.Text := '';



end;



procedure TForm1.ySetting;

var

spQuery : TADOQuery;

conStr : String;



begin



clearEditBox;

spQuery := TADOQuery.Create(self);

conStr := 'Provider=Microsoft.Jet.OLEDB.4.0;Data ';

conStr := conStr + 'Source='+curDir+'dbFilemoney.mdb;Persist ';

conStr := conStr + 'Security Info=False';

spQuery.ConnectionString := conStr;



spQuery.Close;

spQuery.SQL.Clear;

spQuery.SQL.Add('select * from year1');

spQuery.Open;

yds.DataSet := spQuery;

ydb.DataSource := yds;

yds.DataSet.Open;



Edit1.Text := ydb.DataSource.DataSet.FieldByName('이름').AsString;

Edit2.Text := ydb.DataSource.DataSet.FieldByName('주민번호').AsString;

Edit3.Text := ydb.DataSource.DataSet.FieldByName('주민세').AsString;

Edit4.Text := ydb.DataSource.DataSet.FieldByName('소득세').AsString;

Edit5.Text := ydb.DataSource.DataSet.FieldByName('의료보험').AsString;

Edit6.Text := ydb.DataSource.DataSet.FieldByName('국민연금').AsString;

Edit7.Text := ydb.DataSource.DataSet.FieldByName('산재보험').AsString;

Edit8.Text := ydb.DataSource.DataSet.FieldByName('고용보험').AsString;

Edit9.Text := ydb.DataSource.DataSet.FieldByName('기타금액').AsString;

Edit10.Text := ydb.DataSource.DataSet.FieldByName('계약총액').AsString;

Edit11.Text := ydb.DataSource.DataSet.FieldByName('월급').AsString;





===========================================================================

Edit12.Text := ydb.DataSource.DataSet.FieldByName('일련번호').AsString;

idNum2 := EDit12.Text;



=> 이 부분에서 에러



[Error] Unit1.pas(172): Undeclared identifier: 'Edit12'



[Error] Unit1.pas(173): Missing operator or semicolon



=============================================================================



end;



procedure TForm1.insertClick(Sender: TObject);

begin



insert.Enabled := false;

BitBtn18.Enabled := false;

BitBtn19.Enabled := false;



BitBtn20.Enabled := true;



yState := 'insert';

clearEditBox;

Edit1.SetFocus;



end;



procedure TForm1.BitBtn18Click(Sender: TObject);

begin



insert.Enabled := false;

BitBtn18.Enabled := false;

BitBtn19.Enabled := false;

BitBtn20.Enabled := true;



================================================================================



idNum2 := Trim(Edit12.Text);



=> 이 부분에서는 다음과 같은 에러가 발생하거든여...

[Error] Unit1.pas(200): Undeclared identifier: 'Edit12'



[Error] Unit1.pas(200): 'END' expected but ')' found

================================================================================



yState := 'update';

Edit1.SetFocus;







end;



procedure TForm1.BitBtn20Click(Sender: TObject);

var

saveQuery, yQuery : TADOQuery;

conStr, queryStr : String;

m3, m4, m5, m6, m7, m8, m9, m10, m11, total1, total2 : longInt;





begin



Edit1.Text := Trim(Edit1.Text);

Edit2.Text := Trim(Edit2.Text);

Edit3.Text := Trim(Edit3.Text);

Edit4.Text := Trim(Edit4.Text);

Edit5.Text := Trim(Edit5.Text);

Edit6.Text := Trim(Edit6.Text);

Edit7.Text := Trim(Edit7.Text);

Edit8.Text := Trim(Edit8.Text);

Edit9.Text := Trim(Edit9.Text);

Edit10.Text := Trim(Edit10.Text);

Edit11.Text := Trim(Edit11.Text);





try m3 := strtoint(edit3.text); except

showmessage('주민세는 숫자로 입력해야 합니다');

end;

try m4 := strtoint(edit4.text); except

showmessage('소득세는 숫자로 입력해야 합니다');

end;

try m5 := strtoint(edit5.text); except

showmessage('의료보험은 숫자로 입력해야 합니다');

end;

try m6 := strtoint(edit6.text); except

showmessage('국민연금 숫자로 입력해야 합니다');

end;

try m7 := strtoint(edit7.text); except

showmessage('산재보험은 숫자로 입력해야 합니다');

end;

try m8 := strtoint(edit8.text); except

showmessage('고용보험은 숫자로 입력해야 합니다');

end;

try m9 := strtoint(edit9.text); except

showmessage('기타금액은 숫자로 입력해야 합니다');

end;

try m10 := strtoint(edit10.text); except

showmessage('계약총액은 숫자로 입력해야 합니다');

end;

try m11 := strtoint(edit11.text); except

showmessage('월급은 숫자로 입력해야 합니다');

end;



total1 := m3 + m4 + m5 + m6 + m7 + m8 + m9;

total2 := m11 - total1;



saveQuery := TADOQuery.Create(self);

conStr := 'Provider=Microsoft.Jet.OLEDB.4.0;Data ';

conStr := conStr + 'Source='+curDir+'dbFilemoney.mdb;Mode=ReadWrite;Persist ';

conStr := conStr + 'Security Info=False';

saveQuery.ConnectionString := conStr;





if yState = 'insert' then begin

queryStr := 'insert into year1(이름,주민번호,주민세,소득세,의료보험,국민연금,산재보험,고용보험,기타금액,계약총액,월급,총지출액,실지급액) values (';

queryStr := queryStr + QuotedStr(Edit1.Text) + ',' + QuotedStr(Edit2.Text) + ',' + Edit3.Text + ',' + Edit4.Text;

queryStr := queryStr + ',' + Edit5.Text + ',' + Edit6.Text + ',' + Edit7.Text + ',' + Edit8.Text + ',';

queryStr := queryStr + Edit9.Text + ',' + Edit10.Text + ',' + Edit11.Text + ',' + inttostr(total1) + ',' + inttostr(total2) + ')';





saveQuery.Close;

saveQuery.SQL.Clear;

saveQuery.SQL.Add(queryStr);

saveQuery.ExecSQL;

saveQuery.Close;





end else if yState = 'update' then begin



queryStr := 'update year1 set 이름 = ' + QuotedStr(Edit1.Text) + ', 주민번호 = ' + QuotedStr(Edit2.Text);

queryStr := queryStr + ', 주민세 = ' + Edit3.Text + ', 소득세 = ' + Edit4.Text + ', 의료보험 = ' + Edit5.Text;

queryStr := queryStr + ', 국민연금 = ' + Edit6.Text + ', 산재보험 = ' + Edit7.Text + ', 고용보험 = ' + Edit8.Text;

queryStr := queryStr + ', 기타금액 = ' + Edit9.Text + ', 계약총액 = ' + Edit10.Text + ', 월급 = ' + Edit11.Text;

queryStr := queryStr + ', 총지출액 = ' + inttostr(total1) + ', 실지급액 = ' + inttostr(total2);

queryStr := queryStr + ' where 일련번호 = ' + idNum2;



saveQuery.Close;

saveQuery.SQL.Clear;

saveQuery.SQL.Add(queryStr);

saveQuery.ExecSQL;

saveQuery.Close;



end;



ySetting;





// insert.Enabled := true;

// BitBtn18.Enabled := true;

// BitBtn19.Enabled := true;

// BitBtn20.Enabled := false;









end;



procedure TForm1.edit1Change(Sender: TObject);

begin



//noEdit;



end;



procedure TForm1.noEdit;

begin



if BitBtn20.Enabled = true then begin



end else begin



returnDefault;





end;



end;





procedure TForm1.BitBtn24Click(Sender: TObject);

begin



ySetting;



insert.Enabled := true;

BitBtn18.Enabled := true;

BitBtn19.Enabled := true;

BitBtn20.Enabled := false;





end;



procedure TForm1.returnDefault;

begin



Edit1.Text := ydb.DataSource.DataSet.FieldByName('이름').AsString;

Edit2.Text := ydb.DataSource.DataSet.FieldByName('주민번호').AsString;

Edit3.Text := ydb.DataSource.DataSet.FieldByName('주민세').AsString;

Edit4.Text := ydb.DataSource.DataSet.FieldByName('소득세').AsString;

Edit5.Text := ydb.DataSource.DataSet.FieldByName('의료보험').AsString;

Edit6.Text := ydb.DataSource.DataSet.FieldByName('국민연금').AsString;

Edit7.Text := ydb.DataSource.DataSet.FieldByName('산재보험').AsString;

Edit8.Text := ydb.DataSource.DataSet.FieldByName('고용보험').AsString;

Edit9.Text := ydb.DataSource.DataSet.FieldByName('기타금액').AsString;

Edit10.Text := ydb.DataSource.DataSet.FieldByName('계약총액').AsString;

Edit11.Text := ydb.DataSource.DataSet.FieldByName('월급').AsString;







--------------------------------------------------------------------------------

Edit12.Text := ydb.DataSource.DataSet.FieldByName('일련번호').AsString;

idNum2 := Edit12.Text;



=> 이 부분에서 다음과 같은 에러가 나거든여



[Error] Unit1.pas(362): Undeclared identifier: 'Edit12'



[Error] Unit1.pas(363): Missing operator or semicolon

--------------------------------------------------------------------------------





end;





procedure TForm1.BitBtn22Click(Sender: TObject);





=====================================================

begin



=> 이 부부에서 에러



[Error] Unit1.pas(369): Identifier redeclared: 'TForm1.BitBtn22Click'

===================================================

Close;

end;



end.













1  COMMENTS
  • Profile
    서철기 2001.04.07 18:29


    > [Hint] Unit1.pas(63): Private symbol 'sState' declared but never used

    > [Hint] Unit1.pas(65): Private symbol 'sQuery' declared but never used

    > [Hint] Unit1.pas(69): Private symbol 'noEdit' declared but never used



    state 변수가 선언은 되었지만 사용된 적이 없다. 에러는 아니구요..

    메모리 관리를 위해서 사용하지 않으면 없애야 겠죠..



    > [Error] Unit1.pas(172): Undeclared identifier: 'Edit12'

    Edit12가 선언되지 않았다는 군요

    > [Error] Unit1.pas(173): Missing operator or semicolon

    바로 위 Error 때문인것 같구요



    도움이 되셨기를..