RSS订阅 | 匿名投稿
您的位置:网站首页 > 数据库 > 正文

Delphi获取Access中的表名代码

作者:admin 来源: 日期:2013/11/12 11:18:17 人气: 标签:

//声明变量:
lString,lTableName:TStrings;
//-----------获取表名信息-------------
lString:=TStringList.Create;
lTableName:=TStringList.Create;
DM_Conn.con_Access.GetTableNames(lString,True);
for i:=0 to lString.Count-1 do
begin
if (lString.Strings[i]<>'MSysACEs')
and (lString.Strings[i]<>'MSysObjects')
and (lString.Strings[i]<>'MSysQueries')
and (lString.Strings[i]<>'MSysRelationships') then
lTableName.Add(lString.Strings[i]);
end;
我最终使用的代码如下:
procedure TForm1.FormCreate(Sender: TObject);
var
//声明变量:
lString:TStrings;
i:Integer;
Begin
//-----------获取表名信息-------------
lString:=TStringList.Create;
form1.ADOConnection1.GetTableNames(lString,True);
for i:=0 to lString.Count-1 do
begin
if (lString.Strings[i]<>'MSysACEs')
and (lString.Strings[i]<>'MSysObjects')
and (lString.Strings[i]<>'MSysQueries')
and (lString.Strings[i]<>'MSysRelationships') then
form1.combobox1.Items.Add(lString.Strings[i]);
End;
button2.Enabled:=false;
end;
procedure TForm1.FormCreate(Sender: TObject);
var//声明变量:
lString:TStrings;
i:Integer;
Begin    //-----------获取表名信息-------------lString:=TStringList.Create;
form1.ADOConnection1.GetTableNames(lString,True);
for i:=0 to lString.Count-1 dobeginif (lString.Strings[i]<>'MSysACEs')and (lString.Strings[i]<>'MSysObjects')and (lString.Strings[i]<>'MSysQueries')and (lString.Strings[i]<>'MSysRelationships') thenform1.combobox1.Items.Add(lString.Strings[i]);
End;
button2.Enabled:=false;
end;

读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址: