Q&A

  • 소스 좀 봐주세요....<<급>>
안냐세요

먼저 소스 좀 봐주세요...

아래에 보면 나이계산과 남녀구별하는 부분이 있습니다.

이 두부분을 변경하고 싶은데요.... 소스를 좀 도와주세요...



지금 Combobox를 이용하여 선택하면 DBGrid에 뿌려주는 형식입니다.

그런데 DB에는 Age필드와 Sex필드는 없어서 현디비 뒤어 추가로 만들었습니다.

나이와 성별을 계산후 자동으로 새로운 필드인 Sex나 Age필드에 각각의 레코드의 값을 넣어두고 싶습니다.

즉, 구한 값을 Age,Sex필드에 넣어서 그것을 Combobox에서 선택하면 되지 않을까 싶은데요....



소스좀 보시고, 쉽게 아주 쉽게 너무 쉬워서 초보라도 한 눈에 보고 이해할수 있을정도로 가르쳐 주시면 넘 감사하겠습니다.



unit Unit27;



interface



uses

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

Grids, DBGrids, StdCtrls, ExtCtrls, Db, DBTables, Mask, DBCtrls, ComCtrls,

TeEngine, Series, TeeProcs, Chart, DBChart;



type

TForm27 = class(TForm)

Panel1: TPanel;

Label1: TLabel;

Button25: TButton;

Button26: TButton;

Button1: TButton;

DBNavigator1: TDBNavigator;

Button2: TButton;

Edit1: TEdit;

Panel2: TPanel;

Label3: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

Label10: TLabel;

Label11: TLabel;

Label12: TLabel;

Label13: TLabel;

Label14: TLabel;

DBEdit9: TDBEdit;

PageControl1: TPageControl;

TabSheet1: TTabSheet;

Label2: TLabel;

Label4: TLabel;

Edit2: TEdit;

Panel3: TPanel;

Label16: TLabel;

ComboBox1: TComboBox;

TabSheet2: TTabSheet;

Label15: TLabel;

Label17: TLabel;

Label18: TLabel;

Label19: TLabel;

Edit4: TEdit;

Edit5: TEdit;

TabSheet3: TTabSheet;

Label21: TLabel;

Label22: TLabel;

Panel4: TPanel;

Label20: TLabel;

Edit6: TEdit;

Edit7: TEdit;

TabSheet4: TTabSheet;

Label24: TLabel;

Label25: TLabel;

Panel5: TPanel;

Label23: TLabel;

Edit8: TEdit;

Edit9: TEdit;

TabSheet5: TTabSheet;

Label27: TLabel;

Label28: TLabel;

Panel6: TPanel;

Label26: TLabel;

Edit10: TEdit;

Edit11: TEdit;

DBGrid1: TDBGrid;

DataSource1: TDataSource;

DBEdit10: TDBEdit;

DBEdit11: TDBEdit;

DBEdit1: TDBEdit;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

DBEdit4: TDBEdit;

DBEdit5: TDBEdit;

DBEdit6: TDBEdit;

DBEdit7: TDBEdit;

DBEdit8: TDBEdit;

Table1: TTable;

Edit3: TEdit;

Panel8: TPanel;

Label30: TLabel;

ComboBox3: TComboBox;

ComboBox4: TComboBox;

ComboBox5: TComboBox;

ComboBox6: TComboBox;

Table1StringField: TStringField;

Table1StringField2: TStringField;

Table1StringField3: TStringField;

Table1StringField4: TStringField;

Table1StringField5: TStringField;

Table1StringField6: TStringField;

Table1StringField7: TStringField;

Table1StringField8: TStringField;

Table1StringField9: TStringField;

Table1StringField10: TStringField;

Table1StringField11: TStringField;

Table1StringField12: TStringField;

Table1Sex: TStringField;

Edit12: TEdit;

Edit13: TEdit;

Button3: TButton;

Button4: TButton;

procedure Button25Click(Sender: TObject);

procedure Button26Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure ComboBox3Change(Sender: TObject);

procedure Table1AfterOpen(DataSet: TDataSet);

procedure ComboBox4Change(Sender: TObject);

procedure ComboBox6Change(Sender: TObject);

procedure ComboBox1Change(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Table1BeforePost(DataSet: TDataSet);





private

{ Private declarations }

public

{ Public declarations }

end;



var

Form27: TForm27;



implementation



uses Unit4, Unit1;



{$R *.DFM}



procedure TForm27.Button25Click(Sender: TObject);

begin

form27.hide;

form4.show;

end;



procedure TForm27.Button26Click(Sender: TObject);

begin

form27.hide;

form1.show;

end;



procedure TForm27.Button1Click(Sender: TObject);

begin

if Table1.Locate('이름',Edit1.Text,[lopartialkey])

=False then

showMessage('검색한 인원의 찾을 수 없습니다');

end;



procedure TForm27.Button2Click(Sender: TObject);

begin

close;

end;







procedure TForm27.ComboBox3Change(Sender: TObject);

var

i,t:integer;

begin

Table1.Filtered :=false;

t:=table1.RecordCount ;

edit4.text:= IntTostr(Table1.RecordCount);

if t>0then begin

case combobox3.ItemIndex of

0 : begin

table1.Filtered := false;

edit4.text:= IntTostr(Table1.RecordCount);

edit5.text:='';

end;



1 : begin

table1.Filtered := false;

table1.Filter := '세대주 = ''세''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit4.text:=IntTostr(Table1.RecordCount);

edit5.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

end;

end;

end;







procedure TForm27.Table1AfterOpen(DataSet: TDataSet);

begin

Edit4.text:=IntTostr(Table1.RecordCount);

end;



procedure TForm27.ComboBox4Change(Sender: TObject);

var

i,t:integer;

begin

Table1.Filtered :=false;

t:=table1.RecordCount ;

edit6.text:= IntTostr(Table1.RecordCount);

if t>0then begin

case combobox4.ItemIndex of

0 : begin

table1.Filtered := false;

edit6.text:= IntTostr(Table1.RecordCount);

edit7.text:='';

end;



1 : begin

table1.Filtered := false;

table1.Filter := '직업 = ''상업''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

edit6.text:= IntTostr(Table1.RecordCount);

end;

2 : begin

table1.Filtered := false;

table1.Filter := '직업 = ''수산업''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit6.text:= IntTostr(Table1.RecordCount);

edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

3 : begin

table1.Filtered := false;

table1.Filter := '직업 = ''서비스업''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit6.text:= IntTostr(Table1.RecordCount);

edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

4 : begin

table1.Filtered := false;

table1.Filter := '직업 = ''공무원''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit6.text:= IntTostr(Table1.RecordCount);

edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

5 : begin

table1.Filtered := false;

table1.Filter := '직업 = ''회사원''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit6.text:= IntTostr(Table1.RecordCount);

edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

6 : begin

table1.Filtered := false;

table1.Filter := '직업 = ''학생''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit6.text:= IntTostr(Table1.RecordCount);

edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

7 : begin

table1.Filtered := false;

table1.Filter := '직업 = ''기타''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit6.text:= IntTostr(Table1.RecordCount);

edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

end;

end;

end;





procedure TForm27.ComboBox6Change(Sender: TObject);

var

i,t:integer;

begin

Table1.Filtered :=false;

t:=table1.RecordCount ;

edit10.text:= IntTostr(Table1.RecordCount);

if t>0then begin

case combobox6.ItemIndex of

0 : begin

table1.Filtered := false;

edit10.text:= IntTostr(Table1.RecordCount);

edit11.text:='';

end;

1 : begin

table1.Filtered := false;

table1.Filter := '분석 = ''A''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit10.text:= IntTostr(Table1.RecordCount);

edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

2 : begin

table1.Filtered := false;

table1.Filter := '분석 = ''B''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit10.text:= IntTostr(Table1.RecordCount);

edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%'; end;

3 : begin

table1.Filtered := false;

table1.Filter := '분석 = ''C''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit10.text:= IntTostr(Table1.RecordCount);

edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

4 : begin

table1.Filtered := false;

table1.Filter := '분석 = ''D''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit10.text:= IntTostr(Table1.RecordCount);

edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

5 : begin

table1.Filtered := false;

table1.Filter := '분석 = ''E''';

table1.Filtered := true;

edit10.text:= IntTostr(Table1.RecordCount);

i:=Table1.RecordCount;

edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

6 : begin

table1.Filtered := false;

table1.Filter := '분석 = ''F''';

table1.Filtered := true;

edit10.text:= IntTostr(Table1.RecordCount);

i:=Table1.RecordCount;

edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

end;

end;

end;





procedure TForm27.ComboBox1Change(Sender: TObject);

var

i,t:integer;

begin

Table1.Filtered :=false;

t:=table1.RecordCount ;

edit2.text:= IntTostr(Table1.RecordCount);

if t>0then begin

case combobox1.ItemIndex of

0 : begin

table1.Filtered := false;

edit2.text:= IntTostr(Table1.RecordCount);

edit3.text:='';

end;



1 : begin

table1.Filtered := false;

table1.Filter := 'sex = ''남자''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit2.text:=IntTostr(Table1.RecordCount);

edit3.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

2 : begin

table1.Filtered := false;

table1.Filter := 'sex = ''여자''';

table1.Filtered := true;

i:=Table1.RecordCount;

edit2.text:=IntTostr(Table1.RecordCount);

edit3.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

end;

end;

end;



end;



procedure TForm27.Button3Click(Sender: TObject);

var

reply:String;

s:string;

begin

reply:=copy(Table1.fieldByName('주민등록번호').AsString,8,1);

if (reply='1')or(reply='3') then

begin

Table1.edit;

Table1.FieldByName('sex').AsString:='남자';

Table1.Post;

end

else if (reply='2') or(reply='4') then

begin

Table1.Edit;

Table1.FieldByName('sex').AsString:='여자';

Table1.Post;

end

else

showMessage('오류^^;');

end;



procedure TForm27.Button4Click(Sender: TObject);

var

yy,mmdd,nowyy,nowmmdd:string;

reply:string;

a,yy1,mm1,dd1:integer;

begin

yy:=copy(Table1.fieldByName('주민등록번호').AsString,1,2);

mmdd:=copy(Table1.FieldByName('주민등록번호').AsString,3,4);

reply:=copy(Table1.FieldByName('주민등록번호').AsString,8,1);

if (reply='1')or(reply='2')then

yy:='19'+yy

else if(reply='3')or(reply='4') then

yy:='20'+yy

else begin

ShoWmessage('오류^^;');

exit;

end;

nowyy:=formatDateTime('yyyy',Date);

nowmmdd:=FormatDateTime('mm',Date)+FormatDateTime('dd',Date);

if nowmmdd<=mmdd then

a:=InttoStr(StrtoInt(nowyy)-StrtoInt(yy)-1)

Table1.FieldByName('age').AsInteger:=a;

else

a:=InttoStr(StrtoInt(nowyy)-Strtoint(yy));

Table1.FieldByName('age').AsInteger:=a;

end;



procedure TForm27.Table1BeforePost(DataSet: TDataSet);

var

reply:String;

s:string;

begin

reply:=copy(Table1.fieldByName('주민등록번호').AsString,8,1);

if (reply='1')or(reply='3') then

begin

Table1.edit;

Table1.FieldByName('sex').AsString:='남자';

Table1.Post;

end

else if (reply='2') or(reply='4') then

begin

Table1.Edit;

Table1.FieldByName('sex').AsString:='여자';

Table1.Post;

end

else

showMessage('오류^^;');

end;



END.



1  COMMENTS
  • Profile
    kingdol 2000.02.17 00:42
    서지현 wrote:

    > 안냐세요

    > 먼저 소스 좀 봐주세요...

    > 아래에 보면 나이계산과 남녀구별하는 부분이 있습니다.

    > 이 두부분을 변경하고 싶은데요.... 소스를 좀 도와주세요...

    >

    > 지금 Combobox를 이용하여 선택하면 DBGrid에 뿌려주는 형식입니다.

    > 그런데 DB에는 Age필드와 Sex필드는 없어서 현디비 뒤어 추가로 만들었습니다.

    > 나이와 성별을 계산후 자동으로 새로운 필드인 Sex나 Age필드에 각각의 레코드의 값을 넣어두고 싶습니다.

    > 즉, 구한 값을 Age,Sex필드에 넣어서 그것을 Combobox에서 선택하면 되지 않을까 싶은데요....

    >

    > 소스좀 보시고, 쉽게 아주 쉽게 너무 쉬워서 초보라도 한 눈에 보고 이해할수 있을정도로 가르쳐 주시면 넘 감사하겠습니다.

    >

    > unit Unit27;

    >

    > interface

    >

    > uses

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

    > Grids, DBGrids, StdCtrls, ExtCtrls, Db, DBTables, Mask, DBCtrls, ComCtrls,

    > TeEngine, Series, TeeProcs, Chart, DBChart;

    >

    > type

    > TForm27 = class(TForm)

    > Panel1: TPanel;

    > Label1: TLabel;

    > Button25: TButton;

    > Button26: TButton;

    > Button1: TButton;

    > DBNavigator1: TDBNavigator;

    > Button2: TButton;

    > Edit1: TEdit;

    > Panel2: TPanel;

    > Label3: TLabel;

    > Label5: TLabel;

    > Label6: TLabel;

    > Label7: TLabel;

    > Label8: TLabel;

    > Label9: TLabel;

    > Label10: TLabel;

    > Label11: TLabel;

    > Label12: TLabel;

    > Label13: TLabel;

    > Label14: TLabel;

    > DBEdit9: TDBEdit;

    > PageControl1: TPageControl;

    > TabSheet1: TTabSheet;

    > Label2: TLabel;

    > Label4: TLabel;

    > Edit2: TEdit;

    > Panel3: TPanel;

    > Label16: TLabel;

    > ComboBox1: TComboBox;

    > TabSheet2: TTabSheet;

    > Label15: TLabel;

    > Label17: TLabel;

    > Label18: TLabel;

    > Label19: TLabel;

    > Edit4: TEdit;

    > Edit5: TEdit;

    > TabSheet3: TTabSheet;

    > Label21: TLabel;

    > Label22: TLabel;

    > Panel4: TPanel;

    > Label20: TLabel;

    > Edit6: TEdit;

    > Edit7: TEdit;

    > TabSheet4: TTabSheet;

    > Label24: TLabel;

    > Label25: TLabel;

    > Panel5: TPanel;

    > Label23: TLabel;

    > Edit8: TEdit;

    > Edit9: TEdit;

    > TabSheet5: TTabSheet;

    > Label27: TLabel;

    > Label28: TLabel;

    > Panel6: TPanel;

    > Label26: TLabel;

    > Edit10: TEdit;

    > Edit11: TEdit;

    > DBGrid1: TDBGrid;

    > DataSource1: TDataSource;

    > DBEdit10: TDBEdit;

    > DBEdit11: TDBEdit;

    > DBEdit1: TDBEdit;

    > DBEdit2: TDBEdit;

    > DBEdit3: TDBEdit;

    > DBEdit4: TDBEdit;

    > DBEdit5: TDBEdit;

    > DBEdit6: TDBEdit;

    > DBEdit7: TDBEdit;

    > DBEdit8: TDBEdit;

    > Table1: TTable;

    > Edit3: TEdit;

    > Panel8: TPanel;

    > Label30: TLabel;

    > ComboBox3: TComboBox;

    > ComboBox4: TComboBox;

    > ComboBox5: TComboBox;

    > ComboBox6: TComboBox;

    > Table1StringField: TStringField;

    > Table1StringField2: TStringField;

    > Table1StringField3: TStringField;

    > Table1StringField4: TStringField;

    > Table1StringField5: TStringField;

    > Table1StringField6: TStringField;

    > Table1StringField7: TStringField;

    > Table1StringField8: TStringField;

    > Table1StringField9: TStringField;

    > Table1StringField10: TStringField;

    > Table1StringField11: TStringField;

    > Table1StringField12: TStringField;

    > Table1Sex: TStringField;

    > Edit12: TEdit;

    > Edit13: TEdit;

    > Button3: TButton;

    > Button4: TButton;

    > procedure Button25Click(Sender: TObject);

    > procedure Button26Click(Sender: TObject);

    > procedure Button1Click(Sender: TObject);

    > procedure Button2Click(Sender: TObject);

    > procedure ComboBox3Change(Sender: TObject);

    > procedure Table1AfterOpen(DataSet: TDataSet);

    > procedure ComboBox4Change(Sender: TObject);

    > procedure ComboBox6Change(Sender: TObject);

    > procedure ComboBox1Change(Sender: TObject);

    > procedure Button3Click(Sender: TObject);

    > procedure Button4Click(Sender: TObject);

    > procedure Table1BeforePost(DataSet: TDataSet);

    >

    >

    > private

    > { Private declarations }

    > public

    > { Public declarations }

    > end;

    >

    > var

    > Form27: TForm27;

    >

    > implementation

    >

    > uses Unit4, Unit1;

    >

    > {$R *.DFM}

    >

    > procedure TForm27.Button25Click(Sender: TObject);

    > begin

    > form27.hide;

    > form4.show;

    > end;

    >

    > procedure TForm27.Button26Click(Sender: TObject);

    > begin

    > form27.hide;

    > form1.show;

    > end;

    >

    > procedure TForm27.Button1Click(Sender: TObject);

    > begin

    > if Table1.Locate('이름',Edit1.Text,[lopartialkey])

    > =False then

    > showMessage('검색한 인원의 찾을 수 없습니다');

    > end;

    >

    > procedure TForm27.Button2Click(Sender: TObject);

    > begin

    > close;

    > end;

    >

    >

    >

    > procedure TForm27.ComboBox3Change(Sender: TObject);

    > var

    > i,t:integer;

    > begin

    > Table1.Filtered :=false;

    > t:=table1.RecordCount ;

    > edit4.text:= IntTostr(Table1.RecordCount);

    > if t>0then begin

    > case combobox3.ItemIndex of

    > 0 : begin

    > table1.Filtered := false;

    > edit4.text:= IntTostr(Table1.RecordCount);

    > edit5.text:='';

    > end;

    >

    > 1 : begin

    > table1.Filtered := false;

    > table1.Filter := '세대주 = ''세''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit4.text:=IntTostr(Table1.RecordCount);

    > edit5.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > end;

    > end;

    > end;

    >

    >

    >

    > procedure TForm27.Table1AfterOpen(DataSet: TDataSet);

    > begin

    > Edit4.text:=IntTostr(Table1.RecordCount);

    > end;

    >

    > procedure TForm27.ComboBox4Change(Sender: TObject);

    > var

    > i,t:integer;

    > begin

    > Table1.Filtered :=false;

    > t:=table1.RecordCount ;

    > edit6.text:= IntTostr(Table1.RecordCount);

    > if t>0then begin

    > case combobox4.ItemIndex of

    > 0 : begin

    > table1.Filtered := false;

    > edit6.text:= IntTostr(Table1.RecordCount);

    > edit7.text:='';

    > end;

    >

    > 1 : begin

    > table1.Filtered := false;

    > table1.Filter := '직업 = ''상업''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > edit6.text:= IntTostr(Table1.RecordCount);

    > end;

    > 2 : begin

    > table1.Filtered := false;

    > table1.Filter := '직업 = ''수산업''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit6.text:= IntTostr(Table1.RecordCount);

    > edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 3 : begin

    > table1.Filtered := false;

    > table1.Filter := '직업 = ''서비스업''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit6.text:= IntTostr(Table1.RecordCount);

    > edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 4 : begin

    > table1.Filtered := false;

    > table1.Filter := '직업 = ''공무원''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit6.text:= IntTostr(Table1.RecordCount);

    > edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 5 : begin

    > table1.Filtered := false;

    > table1.Filter := '직업 = ''회사원''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit6.text:= IntTostr(Table1.RecordCount);

    > edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 6 : begin

    > table1.Filtered := false;

    > table1.Filter := '직업 = ''학생''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit6.text:= IntTostr(Table1.RecordCount);

    > edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 7 : begin

    > table1.Filtered := false;

    > table1.Filter := '직업 = ''기타''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit6.text:= IntTostr(Table1.RecordCount);

    > edit7.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > end;

    > end;

    > end;

    >

    >

    > procedure TForm27.ComboBox6Change(Sender: TObject);

    > var

    > i,t:integer;

    > begin

    > Table1.Filtered :=false;

    > t:=table1.RecordCount ;

    > edit10.text:= IntTostr(Table1.RecordCount);

    > if t>0then begin

    > case combobox6.ItemIndex of

    > 0 : begin

    > table1.Filtered := false;

    > edit10.text:= IntTostr(Table1.RecordCount);

    > edit11.text:='';

    > end;

    > 1 : begin

    > table1.Filtered := false;

    > table1.Filter := '분석 = ''A''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit10.text:= IntTostr(Table1.RecordCount);

    > edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 2 : begin

    > table1.Filtered := false;

    > table1.Filter := '분석 = ''B''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit10.text:= IntTostr(Table1.RecordCount);

    > edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%'; end;

    > 3 : begin

    > table1.Filtered := false;

    > table1.Filter := '분석 = ''C''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit10.text:= IntTostr(Table1.RecordCount);

    > edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 4 : begin

    > table1.Filtered := false;

    > table1.Filter := '분석 = ''D''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit10.text:= IntTostr(Table1.RecordCount);

    > edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 5 : begin

    > table1.Filtered := false;

    > table1.Filter := '분석 = ''E''';

    > table1.Filtered := true;

    > edit10.text:= IntTostr(Table1.RecordCount);

    > i:=Table1.RecordCount;

    > edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 6 : begin

    > table1.Filtered := false;

    > table1.Filter := '분석 = ''F''';

    > table1.Filtered := true;

    > edit10.text:= IntTostr(Table1.RecordCount);

    > i:=Table1.RecordCount;

    > edit11.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > end;

    > end;

    > end;

    >

    >

    > procedure TForm27.ComboBox1Change(Sender: TObject);

    > var

    > i,t:integer;

    > begin

    > Table1.Filtered :=false;

    > t:=table1.RecordCount ;

    > edit2.text:= IntTostr(Table1.RecordCount);

    > if t>0then begin

    > case combobox1.ItemIndex of

    > 0 : begin

    > table1.Filtered := false;

    > edit2.text:= IntTostr(Table1.RecordCount);

    > edit3.text:='';

    > end;

    >

    > 1 : begin

    > table1.Filtered := false;

    > table1.Filter := 'sex = ''남자''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit2.text:=IntTostr(Table1.RecordCount);

    > edit3.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > 2 : begin

    > table1.Filtered := false;

    > table1.Filter := 'sex = ''여자''';

    > table1.Filtered := true;

    > i:=Table1.RecordCount;

    > edit2.text:=IntTostr(Table1.RecordCount);

    > edit3.text:=FloatTostr(trunc((i/t*100)*100+0.5)/100)+'%';

    > end;

    > end;

    > end;

    >

    > end;

    >

    > procedure TForm27.Button3Click(Sender: TObject);

    > var

    > reply:String;

    > s:string;

    > begin

    > reply:=copy(Table1.fieldByName('주민등록번호').AsString,8,1);

    > if (reply='1')or(reply='3') then

    > begin

    > Table1.edit;

    > Table1.FieldByName('sex').AsString:='남자';

    > Table1.Post;

    > end

    > else if (reply='2') or(reply='4') then

    > begin

    > Table1.Edit;

    > Table1.FieldByName('sex').AsString:='여자';

    > Table1.Post;

    > end

    > else

    > showMessage('오류^^;');

    > end;

    >

    > procedure TForm27.Button4Click(Sender: TObject);

    > var

    > yy,mmdd,nowyy,nowmmdd:string;

    > reply:string;

    > a,yy1,mm1,dd1:integer;

    > begin

    > yy:=copy(Table1.fieldByName('주민등록번호').AsString,1,2);

    > mmdd:=copy(Table1.FieldByName('주민등록번호').AsString,3,4);

    > reply:=copy(Table1.FieldByName('주민등록번호').AsString,8,1);

    > if (reply='1')or(reply='2')then

    > yy:='19'+yy

    > else if(reply='3')or(reply='4') then

    > yy:='20'+yy

    > else begin

    > ShoWmessage('오류^^;');

    > exit;

    > end;

    > nowyy:=formatDateTime('yyyy',Date);

    > nowmmdd:=FormatDateTime('mm',Date)+FormatDateTime('dd',Date);

    > if nowmmdd<=mmdd then

    > a:=InttoStr(StrtoInt(nowyy)-StrtoInt(yy)-1)

    > Table1.FieldByName('age').AsInteger:=a;

    > else

    > a:=InttoStr(StrtoInt(nowyy)-Strtoint(yy));

    > Table1.FieldByName('age').AsInteger:=a;

    > end;

    >

    > procedure TForm27.Table1BeforePost(DataSet: TDataSet);

    > var

    > reply:String;

    > s:string;

    > begin

    > reply:=copy(Table1.fieldByName('주민등록번호').AsString,8,1);

    > if (reply='1')or(reply='3') then

    > begin

    > Table1.edit;

    > Table1.FieldByName('sex').AsString:='남자';

    > Table1.Post;

    > end

    > else if (reply='2') or(reply='4') then

    > begin

    > Table1.Edit;

    > Table1.FieldByName('sex').AsString:='여자';

    > Table1.Post;

    > end

    > else

    > showMessage('오류^^;');

    > end;

    >

    > END.

    >



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

    글세여....

    맞는진 모르겠지만...

    어떤 용도로 사용하려는지 애매해서...

    그리구 age와 sex 필드가 실제 테이블의 필드로 존재하는지 아님 테이블 콤포넌트의

    필드에디터를 통해 가상의 필드만 추가한것인지 애매해서리...

    암튼...

    많이 고치진 않구여....





    procedure TForm1.Button2Click(Sender: TObject);

    var

    yy,mmdd,nowyy,nowmmdd:string;

    reply:string;

    a,yy1,mm1,dd1:integer;

    begin

    Table1.First;

    While not Table1.EOF do

    begin

    yy := copy(Table1.fieldByName('jumin').AsString,1,2);

    mmdd:=copy(Table1.FieldByName('jumin').AsString,3,4);

    reply:=copy(Table1.FieldByName('jumin').AsString,7,1); // 이부분이 잘못되어 있던거 같던데... (8,1, 이 아니라 7,1이죠)

    if (reply='1')or(reply='2')then

    yy:='19'+yy

    else if(reply='3')or(reply='4') then

    yy:='20'+yy

    else

    begin

    ShoWmessage('오류^^;');

    exit;

    end;

    Table1.Edit;

    nowyy:=formatDateTime('yyyy',Date);

    nowmmdd:=FormatDateTime('mm',Date)+FormatDateTime('dd',Date);

    // 아래부분에서도 데이타 형변환에 약간의 문제가....

    if nowmmdd<=mmdd then

    Table1.FieldByName('age').AsInteger:= StrtoInt(nowyy)-StrtoInt(yy)-1

    else

    Table1.FieldByName('age').AsInteger := StrtoInt(nowyy)-Strtoint(yy);

    Table1.Post;



    // 남,여 구분을 구하는 부분

    if (reply='1')or(reply='3') then

    begin

    Table1.edit;

    Table1.FieldByName('sex').AsString:='남자';

    end

    else if (reply='2') or(reply='4') then

    begin

    Table1.Edit;

    Table1.FieldByName('sex').AsString:='여자';

    end

    else

    showMessage('오류^^;');

    Table1.Post;



    Table1.Next;

    end;

    Table1.First;

    Database1.ApplyUpdates([Table1]); // 이부분은 첨가돼야 구한 age, sex 값이

    db상에 write 되는거 같드라구여...

    end;



    글세여...

    원하는 답이 아닌거 같기두하구..쩝쩝...

    암튼... 질문있으면 다시 알려줘여...



    ps .. 글쿠 이건 사견인데여...

    주민번호, 나이, 성별 등등은 나중에 계산 or 입력에의해 자료를 관리하는 것

    보다는 애초 데이타가 생성될 시점에 같이 입력해주는것이 좋을것두 같은데...



    • 최진영
    • 2000.02.17 01:35
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 이현우
      2000.02.17 02:17
      최진영 wrote: > 안녕하세요. 참으로 노력은 해봤지만 좋은 방법이있을까해서 > 찾아왔습니다. > (1)...
    • 조규춘
      2000.02.17 02:57
      헬프미플리즈 wrote: > 버튼을 누르면 일단 윈도우용 프로그램(wgnuplot)을 실행시키고 나서 그 안에서 lo...
    • 윤병익
    • 2000.02.17 01:05
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 허세준
      2000.02.17 04:18
      윤병익 wrote: > 안녕하세요.. 전 델파이를 열씨미 공부하고있는 놈입니다... > > 지금 제가 하고 있는...
    • 박성훈
      2000.02.17 19:50
      최황용 wrote: > 파라독스 테이블이 하도 잘 깨져서 유틸리티를 만들고자 합니다. > DTUtil32 말고 혹시...
    • 맹구
    • 2000.02.17 00:21
    • 2 COMMENTS
    • /
    • 0 LIKES
    • 최진영
      2000.02.17 01:46
      맹구 wrote: > sql로 날짜로 검색하려구 하는데 에러가 나네요! > error 내용이 date keyword가 잘못되었...
    • mute
      2000.02.17 12:43
      최진영 wrote: > 맹구 wrote: > > sql로 날짜로 검색하려구 하는데 에러가 나네요! > > error 내용이 da...
    • hjcho
    • 2000.02.16 21:45
    • 4 COMMENTS
    • /
    • 0 LIKES
    • 하얀까마귀
      2000.02.16 22:22
      hjcho wrote: > 하나의 버튼 속성을 지정한 후에 > 그 버튼의 속성을 다른 버튼에 똑같이 지정할 수 있...
    • 하얀까마귀
      2000.02.16 22:15
      hjcho wrote: > 하나의 버튼 속성을 지정한 후에 > 그 버튼의 속성을 다른 버튼에 똑같이 지정할 수 있...
    • 조규춘
      2000.02.16 22:14
      hjcho wrote: > 하나의 버튼 속성을 지정한 후에 > 그 버튼의 속성을 다른 버튼에 똑같이 지정할 수 있...
    • hjcho
      2000.02.17 04:26
      툴바에 놓이는 버튼에서는 안되잖아요...???~~~~ 좀 갈켜 주세용~~ 조규춘 wrote: > hjcho wrote: > ...
    • 서지현
    • 2000.02.16 21:07
    • 1 COMMENTS
    • /
    • 0 LIKES
    • kingdol
      2000.02.17 00:42
      서지현 wrote: > 안냐세요 > 먼저 소스 좀 봐주세요... > 아래에 보면 나이계산과 남녀구별하는 부분이 ...
    • park
    • 2000.02.16 19:38
    • 1 COMMENTS
    • /
    • 0 LIKES
    • kingdol
      2000.02.16 22:48
      park wrote: > 라디오 버튼에서 라디오 버튼이 check되었는지 check되지 않았는지 체크할 수 있나요? > ...
    • park
    • 2000.02.16 19:18
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 조영욱
      2000.02.17 18:11
      park wrote: > 안녕하세요! > MDI에서 메뉴를 선택했을때 창은 뜨는데, > 전에 띄워져 있던 창이 활성...
    • 공대규
    • 2000.02.16 19:17
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 오현수
      2000.02.23 07:53
      공대규 wrote: > NT Server 4.0 (SP 5) 시스템이고요, > Delphi 4.0 설치 후, interbase 설치 시작하자 ...
    • nikao76
    • 2000.02.16 19:09
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 하얀까마귀
      2000.02.16 22:30
      이내용으로는 아무런 답변도 해드릴수가 없어요... 그냥 몇자 적을께요.. 현재 소스는 이상이 없네요.. ...
    • 장일형
    • 2000.02.16 08:52
    • 2 COMMENTS
    • /
    • 0 LIKES
    • 정주영
      2000.02.17 01:23
      장일형 wrote: > 델파이 데모를 참조해서 메알을 만들었는데 > 네띠앙에서 네띠앙으로 메일은 잘 가는데 ...
    • 장일형
      2000.02.17 08:51
      답변해 주셔서 감사합니다. 저도 데모에 있는 걸로 테스트 해 보고 iti에 있는 자료도 봤는데 제 소스하...
    • 임파이
    • 2000.02.16 06:46
    • 2 COMMENTS
    • /
    • 0 LIKES
    • 김영대
      2000.02.16 19:44
      임파이 wrote: > 네트워크환경에 가면 현제 접속가능한 컴퓨터가 뜨거든요. > 그래서,궁금한것은 제PC에...
    • 술친구
      2000.02.16 19:25
      임파이 wrote: > 네트워크환경에 가면 현제 접속가능한 컴퓨터가 뜨거든요. > 그래서,궁금한것은 제PC에...