unit logicalDB;interface
uses Windows, Messages,Dialogs,SysUtils;type
//表列表
TTableListRec = record
tbl:string;
tblName:string;
end; //字段列表
TColListRec = record
tbl:string;
col:string;
colName:string;
end; TTableList = array of TTableListRec;
TColList = array of TColListRec; TDBOP = class(TObject)
private
{ Private declarations }
public function GetTableList:TTableList;
function GetColList(Tbl:string):TColList;
procedure Create;
{ Public declarations }
end;implementationuses dmMain;procedure TDBOP.Create;
begin
inherited Create;
end;function TDBOP.GetTableList:TTableList;
var
strsql:string;
count,i:integer;
TableList:TTableList;
begin
i:=0;
strsql := 'select tbl,tbl_name from sys_tbl where modify=1'; dmMain.frmDM.ADOQueryTmp.Active := false;
dmMain.frmDM.ADOQueryTmp.SQL.Clear;
dmMain.frmDM.ADOQueryTmp.SQL.Add(strsql);
try
dmMain.frmDM.ADOConnectionTmp.Connected := true;
dmMain.frmDM.ADOQueryTmp.Active := true;
except
showmessage('ado error');
end;
count := dmMain.frmDM.ADOQueryTmp.RecordCount;
SetLength(TableList,2);//这个地方为动态数组分配空间对不对?
while not dmMain.frmDM.ADOQueryTmp.Recordset.EOF do
begin
TableList[i].tbl := dmMain.frmDM.ADOQueryTmp.FieldByName('tbl').AsString;
TableList[i].tblName := dmMain.frmDM.ADOQueryTmp.FieldByName('tbl_name').AsString;
i := i+1;
dmMain.frmDM.ADOQueryTmp.Recordset.MoveNext;
end;
Result := TableList;end;调用:
procedure TColValueForm.Button1Click(Sender: TObject);var
tableList:TTableList;
dbo:TDBOP ;
begindbo.Create;
tableList := dbo.GetTableList;
我这里怎么知道我的tableList有几个“记录类型”的元素啊?
uses Windows, Messages,Dialogs,SysUtils;type
//表列表
TTableListRec = record
tbl:string;
tblName:string;
end; //字段列表
TColListRec = record
tbl:string;
col:string;
colName:string;
end; TTableList = array of TTableListRec;
TColList = array of TColListRec; TDBOP = class(TObject)
private
{ Private declarations }
public function GetTableList:TTableList;
function GetColList(Tbl:string):TColList;
procedure Create;
{ Public declarations }
end;implementationuses dmMain;procedure TDBOP.Create;
begin
inherited Create;
end;function TDBOP.GetTableList:TTableList;
var
strsql:string;
count,i:integer;
TableList:TTableList;
begin
i:=0;
strsql := 'select tbl,tbl_name from sys_tbl where modify=1'; dmMain.frmDM.ADOQueryTmp.Active := false;
dmMain.frmDM.ADOQueryTmp.SQL.Clear;
dmMain.frmDM.ADOQueryTmp.SQL.Add(strsql);
try
dmMain.frmDM.ADOConnectionTmp.Connected := true;
dmMain.frmDM.ADOQueryTmp.Active := true;
except
showmessage('ado error');
end;
count := dmMain.frmDM.ADOQueryTmp.RecordCount;
SetLength(TableList,2);//这个地方为动态数组分配空间对不对?
while not dmMain.frmDM.ADOQueryTmp.Recordset.EOF do
begin
TableList[i].tbl := dmMain.frmDM.ADOQueryTmp.FieldByName('tbl').AsString;
TableList[i].tblName := dmMain.frmDM.ADOQueryTmp.FieldByName('tbl_name').AsString;
i := i+1;
dmMain.frmDM.ADOQueryTmp.Recordset.MoveNext;
end;
Result := TableList;end;调用:
procedure TColValueForm.Button1Click(Sender: TObject);var
tableList:TTableList;
dbo:TDBOP ;
begindbo.Create;
tableList := dbo.GetTableList;
我这里怎么知道我的tableList有几个“记录类型”的元素啊?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货