컴파일은 되는데 출력화면과 얼마안되는 DB를 연동시킬려다가 출력화면으로 전환시에
에러 메세지가 뜨는데 전 잘 모르겠어염...
고수님 한번 주욱 봐주세여...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button1: TButton;
Button2: TButton;
Table1: TTable;
DataSource1: TDataSource;
Table2: TTable;
DataSource2: TDataSource;
procedure Button1click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.DFM}
procedure TForm1.Button1click(Sender: TObject);
var
dd : single;
//지역변수 선언
var
n : integer;
begin
if (n>100000000) then
begin
edit1.SelText;
edit1.SetFocus;
exit;
end;
if (length(edit1.text)<>0) then
begin
edit1.SelText;
edit1.SetFocus;
exit;
end;
if ((strtoint(edit2.text))<0) or
((strtoint(edit2.text))>100000)then
begin
edit2.seltext;
edit2.SetFocus;
exit;
end;
if (length(edit3.text)<>1) then
begin
edit3.SelText;
edit3.SetFocus;
exit;
end;
//입력범위검사
n := n+1;
table2.append;
table2.fieldbyname('학번').asstring :=edit1.text;
table2.FieldByName('성명').asstring :=edit2.text;
table2.FieldByName('학부').asstring :=edit3.text;
table2.fieldByname('납부유무').asstring :=edit4.text;
table2.Post;
//입력 자료 저장
table1.append;
if uppercase(edit1.text)='95612030' then
begin
table1.FieldByName('성명').asstring:='오세열';
end
else if uppercase(edit1.text)='95612001' then
begin
table1.FieldByName('성명').asstring:='강부중';
end
else if uppercase(edit1.text)='95612027' then
begin
table1.fieldbyname('성명').asstring:='안충원';
end
else if uppercase(edit1.text)='95612025' then
begin
table1.FieldByName('성명').asstring:='송윤강';
end
else if uppercase(edit1.text)='95612002' then
begin
table1.FieldByName('성명').asstring:='구자룡';
end
else if uppercase(edit1.text)='95612003' then
begin
table1.fieldbyname('성명').asstring:='김태완';
end;
if (edit3.text='612')then
begin
table1.FieldByName('학부').asstring :='정보공학부 전자계산';
end;
if (edit4.text='유') then
begin
table1.fieldbyname('납부유무').asstring :='납부했음';
end;
if (edit4.text='무') then
begin
table1.fieldbyname('납부유무').asstring :='납부안했음';
end;
if (edit4.text='유') then
begin
table1.fieldbyname('납부일자').asstring:='yyyy';
end;
table1.post;
//출력 자료 저장
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form2.table1.active :=true;
form2.table2.active :=true;
form2.show;
form2.table1.Active :=false;
form2.table1.active :=false;
table1.Active :=false;
table2.active :=false;
end;
end.