Z
zgyingmu
Unregistered / Unconfirmed
GUEST, unregistred user!
我执行了以下过程,目的是根据table9 的内容动态生成一个Access2000的表
'zgsj',但系统执行到最后一句时,提示‘Capability not supported',不知
是何原因?(但按照Help文件的例子,能生成一个Access2000的表)请高手赐教
!
procedure CreateTable1(DBName,TblName:String; TblType:TTableType);
var
tbl:TTable;
Begin
tbl:=TTable.Create(Application);
tbl.Active:=False;
tbl.DatabaseName:=DBName ;
tbl.TableName:=TblName;
tbl.TableType:=TblType;
tbl.FieldDefs.Clear;
While Not DataModule1.Table9.Eof Do
Begin
tbl.FieldDefs.AddFieldDef.Name := DataModule1.Table9.FieldByName(
'xmbm').AsString;
If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsString,'整
型')=0 Then
Begin
tbl.FieldDefs.AddFieldDef.DataType := ftInteger;
tbl.FieldDefs.AddFieldDef.Required := True;
End
Else If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsStrin
g,'字符型')=0 Then
Begin
tbl.FieldDefs.AddFieldDef.DataType := ftString;
tbl.FieldDefs.AddFieldDef.Size:=DataModule1.Table9.FieldByName(
'xmcd').AsInteger;
End
Else If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsStrin
g,'日期型')=0 Then
tbl.FieldDefs.AddFieldDef.DataType := ftDate
Else If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsStrin
g,'备注型')=0 Then
tbl.FieldDefs.AddFieldDef.DataType := ftMemo
Else If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsStrin
g,'布尔型')=0 Then
tbl.FieldDefs.AddFieldDef.DataType := ftBoolean;
DataModule1.Table9.Next;
End;
DataModule1.Table9.First;
tbl.indexDefs.Clear;
tbl.indexDefs.AddIndexDef.Name := '';
tbl.indexDefs.AddIndexDef.Fields :=DataModule1.Table9.FieldByName('xm
bm').AsString;
tbl.indexDefs.AddIndexDef.Options := [ixPrimary];
tbl.CreateTable;
end;
我用的是Delphi5,我的email:hzyingmu@21cn.com。谢谢!
'zgsj',但系统执行到最后一句时,提示‘Capability not supported',不知
是何原因?(但按照Help文件的例子,能生成一个Access2000的表)请高手赐教
!
procedure CreateTable1(DBName,TblName:String; TblType:TTableType);
var
tbl:TTable;
Begin
tbl:=TTable.Create(Application);
tbl.Active:=False;
tbl.DatabaseName:=DBName ;
tbl.TableName:=TblName;
tbl.TableType:=TblType;
tbl.FieldDefs.Clear;
While Not DataModule1.Table9.Eof Do
Begin
tbl.FieldDefs.AddFieldDef.Name := DataModule1.Table9.FieldByName(
'xmbm').AsString;
If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsString,'整
型')=0 Then
Begin
tbl.FieldDefs.AddFieldDef.DataType := ftInteger;
tbl.FieldDefs.AddFieldDef.Required := True;
End
Else If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsStrin
g,'字符型')=0 Then
Begin
tbl.FieldDefs.AddFieldDef.DataType := ftString;
tbl.FieldDefs.AddFieldDef.Size:=DataModule1.Table9.FieldByName(
'xmcd').AsInteger;
End
Else If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsStrin
g,'日期型')=0 Then
tbl.FieldDefs.AddFieldDef.DataType := ftDate
Else If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsStrin
g,'备注型')=0 Then
tbl.FieldDefs.AddFieldDef.DataType := ftMemo
Else If CompareStr(DataModule1.Table9.FieldByName('xmlx').AsStrin
g,'布尔型')=0 Then
tbl.FieldDefs.AddFieldDef.DataType := ftBoolean;
DataModule1.Table9.Next;
End;
DataModule1.Table9.First;
tbl.indexDefs.Clear;
tbl.indexDefs.AddIndexDef.Name := '';
tbl.indexDefs.AddIndexDef.Fields :=DataModule1.Table9.FieldByName('xm
bm').AsString;
tbl.indexDefs.AddIndexDef.Options := [ixPrimary];
tbl.CreateTable;
end;
我用的是Delphi5,我的email:hzyingmu@21cn.com。谢谢!