各位:
下面是我的问题。我设计院思想是这样的我在一个formcreate中有下面的程序请大家看一下出了什么问题
procedure TForm13.FormCreate(Sender: TObject);
begin
if not table1.Exists then { Don't overwrite an existing table }begin
with table1 do
begin
Active := False; { The Table component must not be active } { First, describe the type of table and give it a name }
DatabaseName := 'local';
TableType := ttparadox;
TableName := 'DBLJ.db'; { Next, describe the fields in the table }
with FieldDefs do
begin
Clear;
Add('book_num', ftstring, 0, True);
Add('book_name', ftString, 0, true);
Add('book_price', ftcurrency, 0, true);
Add('book_year', ftInteger, 0, true);
Add('book_month', ftinteger, 0, true);
Add('income_num', ftinteger, 0, true);
Add('outcome_num', ftinteger, 0, true);
Add('lastmonth_num', ftinteger, 0, true);
Add('thismonth_num', ftinteger, 0, true);
end;
{ Next, describe any indexes }
with IndexDefs do
begin
Clear;
{ The first index has no name because it is a Paradox primary key }
Add('', 'book_num', [ixPrimary, ixUnique]);
end;
{ Now that we have specified what we want, create the table }
CreateTable;
table1.open;
table1.append;
while not table2.eof do
beinn
table1.FieldByName('book_num').asstring:=table2.fieldbyname('book_num').asstring;
table1.FieldByName('book_name').asstring:=table2.fieldbyname('book_name').asstring;
table1.FieldByName('book_price').ascurrency:=table2.fieldbyname('book_price').ascurrency;
table1.post; // end;
table2.edit;
edit3.text:=table2.fieldbyname('book_num').asstring;
end;
end;
end;procedure TForm13.FormClose(Sender: TObject; var Action: TCloseAction);
begin
table1.close;
table1.deletetable;
end;
在这些代码中有下面问题,我的table在第一次是被创建成了当form被关了,那么就是删除了当第二次打开了那么就不会被创建了这样就出现错误码率了。
另一个问题是这样的我当临时表被创建后,从一个table向这个临时表写出数据写出不进去请大家处理一下!table2是没有问题的。
在form 中的table的的设定如下:
DatabaseName := 'local';
TableType := ttdefault;
下面是我的问题。我设计院思想是这样的我在一个formcreate中有下面的程序请大家看一下出了什么问题
procedure TForm13.FormCreate(Sender: TObject);
begin
if not table1.Exists then { Don't overwrite an existing table }begin
with table1 do
begin
Active := False; { The Table component must not be active } { First, describe the type of table and give it a name }
DatabaseName := 'local';
TableType := ttparadox;
TableName := 'DBLJ.db'; { Next, describe the fields in the table }
with FieldDefs do
begin
Clear;
Add('book_num', ftstring, 0, True);
Add('book_name', ftString, 0, true);
Add('book_price', ftcurrency, 0, true);
Add('book_year', ftInteger, 0, true);
Add('book_month', ftinteger, 0, true);
Add('income_num', ftinteger, 0, true);
Add('outcome_num', ftinteger, 0, true);
Add('lastmonth_num', ftinteger, 0, true);
Add('thismonth_num', ftinteger, 0, true);
end;
{ Next, describe any indexes }
with IndexDefs do
begin
Clear;
{ The first index has no name because it is a Paradox primary key }
Add('', 'book_num', [ixPrimary, ixUnique]);
end;
{ Now that we have specified what we want, create the table }
CreateTable;
table1.open;
table1.append;
while not table2.eof do
beinn
table1.FieldByName('book_num').asstring:=table2.fieldbyname('book_num').asstring;
table1.FieldByName('book_name').asstring:=table2.fieldbyname('book_name').asstring;
table1.FieldByName('book_price').ascurrency:=table2.fieldbyname('book_price').ascurrency;
table1.post; // end;
table2.edit;
edit3.text:=table2.fieldbyname('book_num').asstring;
end;
end;
end;procedure TForm13.FormClose(Sender: TObject; var Action: TCloseAction);
begin
table1.close;
table1.deletetable;
end;
在这些代码中有下面问题,我的table在第一次是被创建成了当form被关了,那么就是删除了当第二次打开了那么就不会被创建了这样就出现错误码率了。
另一个问题是这样的我当临时表被创建后,从一个table向这个临时表写出数据写出不进去请大家处理一下!table2是没有问题的。
在form 中的table的的设定如下:
DatabaseName := 'local';
TableType := ttdefault;
var mon_win:tmon_win;
begin
mon_win:=mon_win.create(self);
mon_win.showmodal;
mon_win.free;
end; 其中mon_win是一个form。请问一下。当运行子菜单所要求的form不能show;请问一下
这是为什么请大家说详细一点。