Call GetTableNames to retrieve a list of tables in the associated database. List is a TStrings descendant that receives the table names. Any existing strings are deleted from the list before GetTableNames adds the names of all tables in the database.SystemTables specifies whether the list of table names should include only the database抯 system tables. If SystemTables is True, only the system tables are added to List. If SystemTables is False, the list is filled with ordinary tables.For example, the following line fills a list box with the names of all tables in the database:Database1.GetTableNames(ListBox1.Items, False);如果包含系统表:
Database1.GetTableNames(ListBox1.Items, True);
Database1.GetTableNames(ListBox1.Items, True);
解决方案 »
- 彻底解决TreeView控件状态图标问题
- 如何在DBGrid中选择多个单元格,并在StatusBar中显示选中单元格的和
- delphi和vb两个都懂的人请进,做出来的话,加分同时再加现金作为报酬,分另外开题再加
- Com Object 怎么用
- 窗体大小的问题。
- 如何将普通坐标转为经纬度坐标
- 这种届面是用什么控件做出来的?up 有分
- delphi上运行可以,外面(还是本机)就不行了? 99我!!
- 哪位仁兄有dephi电子书的网址啊,赐俺几个,多谢
- 有“delph开发的数据库程序”有源代码!!!可毕业设计或商用!!!
- 关于DBGRID的问题?
- 出错信息:“MMSYSTEM281无法播放该文件,请检查文件名或安装支持这种文件类型的驱动程序。”如何应付???
GetDatabaseNames(List: TStrings);//象这些东西都是返回了字符串列表!
这是最上一层的操作,它还可以获得各种驱动!procedure GetDriverNames(List: TStrings);
在这个层次上你可以对各个数据库进行操作。当然从这里也可以直接或的你要的各种信息!
procedure GetTableNames(const DatabaseName, Pattern: String; Extensions, SystemTables: Boolean; List: TStrings);
MyStringList := TStringList.Create;
try
Session.GetTableNames('DBDEMOS', '*.db',False, False, MyStringList);
{ Add the table names to a list box }
ListBox1.Items = MyStringList;
finally
MyStringList.Free;
end;
下一层次,就是TDataBase,这个只能获得它这个数据库本身的所有的table
procedure GetTableNames(List: TStrings; SystemTables: Boolean = False);
Database1.GetTableNames(ListBox1.Items, False);
她还可获得指定的表的字段:
procedure GetFieldNames(const TableName: String; List: TStrings);
Database1.GetFieldNames('Employee', ListBox1.Items);