[Error] u2.pas(72): Undeclared identifier: 'parameters'
[Error] u2.pas(72): Missing operator or semicolon
이러한 에러가 납니다...어디가 잘못됐는지..알려주세요~
unit u2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, DBCtrls, Mask, DB, DBTables, Grids, DBGrids;
type
TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
DBComboBox1: TDBComboBox;
DataSource1: TDataSource;
Query1: TQuery;
DBEdit1: TDBEdit;
DBGrid1: TDBGrid;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn5Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
private
db_insert: string;
procedure db_refresh;
procedure db_input;
procedure cls_edit;
procedure dsp_edit;
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses u1;
{$R *.dfm}
procedure TForm2.DB_Refresh;
begin
Query1.Close;
query1.SQL.Clear;
Query1.SQL.Add('Select * From hakjuk');
Query1.SQL.Add('Order By hakbun');
Query1.Open;
end;
procedure TForm2.DB_Input;
begin
Query1.parameters.Paramvalues['N1'] := Trim(dbEdit1.Text);
Query1.Parameters.ParamValues['N2'] := Trim(dbEdit2.Text);
Query1.Parameters.ParamValues['N3'] := Trim(dbEdit3.Text);
Query1.Parameters.ParamValues['N4'] := Trim(dbcombobox1.Text);
Query1.Parameters.ParamValues['N5'] := Trim(dbEdit4.Text);
Query1.Parameters.ParamValues['N6'] := Trim(dbEdit5.Text);
Query1.Parameters.ParamValues['N7'] := Trim(dbEdit6.Text);
end;
procedure TForm2.Cls_Edit;
begin
dbEdit1.Text := '';
dbEdit2.Text := '';
dbEdit3.Text := '';
dbEdit4.Text := '';
dbEdit5.Text := '';
dbEdit6.Text := '';
dbcombobox1.Text := '';
end;
procedure TForm2.Dsp_Edit;
begin
dbEdit1.Text := Query1.FieldByName('hakbun').AsString;
dbEdit2.Text := Query1.FieldByName('name').AsString;
dbEdit3.Text := Query1.FieldByName('birth_day').AsString;
dbEdit4.Text := Query1.FieldByName('grade').AsString;
dbEdit5.Text := query1.FieldByName('tel_no').AsString;
dbEdit6.Text := Query1.FieldByName('hp_no').AsString;
dbcombobox1.Text := Query1.FieldByName('hakgwa').AsString;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
cls_edit;
dsp_edit;
db_insert := '불가능';
end;
procedure TForm2.BitBtn4Click(Sender: TObject);
var
Input_Str: string;
begin
Input_Str:= InputBox('이름 입력', '찾을 이름을 입력하세요','');
if Trim(Input_Str) <> '' Then
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select * From hakjuk');
Query1.SQL.Add('Where name Like :NAME1');
Query1.Parameters.ParamByName('NAME1').Value := '%' +Input_Str + '%';
Query1.Open;
end;
end;
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
if bitbtn1.caption = '삽입' then
begin
db_insert := '가능';
bitbtn1.caption := '취소';
bitbtn2.Enabled := false;
Cls_edit;
end
else
begin
db_insert := '불가능';
bitbtn1.caption := '삽입';
bitbtn2.Enabled := true;
db_refresh;
dsp_edit;
end;
dbedit1.SetFocus;
end;
procedure TForm2.BitBtn3Click(Sender: TObject);
var
select_no : integer;
begin
if trim(dbedit1.text) = '' then
begin
showmessage('이름을 입력하지 않으면 추가나 저장을 할 수 없습니다.');
dbedit1.SetFocus;
exit;
end;
if db_insert = '가능' then
begin
Query1.Close;
query1.SQL.Clear;
Query1.SQL.Add('Insert Into hakjuk ');
Query1.SQL.Add('(hakbun, name, birth_day, hakgwa, grade, tel_no, hp_no) ');
Query1.SQL.Add(' Values ');
Query1.SQL.Add('( :N1, ');
Query1.SQL.Add(' :N2, ');
Query1.SQL.Add(' :N3, ');
Query1.SQL.Add(' :N4, ');
Query1.SQL.Add(' :N5, ');
Query1.SQL.Add(' :N6, ');
Query1.SQL.Add(' :N7 )');
DB_Input;
db_insert := '불가능';
bitbtn1.caption := '삽입';
bitbtn2.Enabled := true;
end
else
begin
Select_no := Query1.FieldByName('bunho').AsInteger;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Update hakjuk ');
Query1.SQL.Add('Set hakbun = :N1, ');
Query1.SQL.Add('name = :N2, ');
Query1.SQL.Add('birth_day = :N3, ');
Query1.SQL.Add('hakgwa = :N4, ');
Query1.SQL.Add('grade = :N5, ');
Query1.SQL.Add('tel_no = :N6 ');
Query1.SQL.Add('hp_no = :N7 ');
Query1.SQL.Add('Where bunho = :N8 ');
DB_Input;
Query1.Parameters.ParamValues['N8'] := Select_no;
end;
Query1.ExecSQL;
DB_Refresh;
dbEdit1.SetFocus;
end;
procedure TForm2.BitBtn2Click(Sender: TObject);
var
ret_msg : integer;
select_no : integer;
begin
if Query1.Recordset.Fields.Count <> 0 then
begin
ret_msg := messagedlg('삭제하시겠습니까?', mtwarning,
[mbyes, mbno],0);
if ret_msg = mryes then
begin
Select_no := Query1.FieldByName('bunho').AsInteger;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Delete From hakjuk ');
Query1.SQL.Add('Where bunho = :N1');
Query1.Parameters.ParamValues['N1'] := Select_no;
Query1.ExecSQL;
DB_Refresh;
Dsp_Edit;
end
else
Application.MessageBox('삭제가 취소되었습니다.',
'삭제취소',MB_OK);
end;
procedure TForm2.BitBtn5Click(Sender: TObject);
begin
form1.show;
end;
end.
=> parameters라는 변수를 선언하지 않고 썼으므로 당근 에러
Query1.parameters.Paramvalues['N1'] := Trim(dbEdit1.Text); //요놈을
=>Query1.parambyname('N1').asstring := Trim(dbEdit1.Text); //바꾸세요
Error] u2.pas(72): Missing operator or semicolon
=> 백발백중 semicolon 아니면 End가 부족하거나 많은경우
procedure TForm2.BitBtn3Click(Sender: TObject);
요 프로시져 맨끝에 End한개 부족이요..
제발 줄좀 들여쓰기 하는 습관 좀 가지세요..