说三道四技术文摘-感悟人生的经典句子
说三道四 > 文档快照

怎样把可以使用的表名输出到一个选择框?-Delphi资料

HTML文档下载 WORD文档下载 PDF文档下载
怎样把可以使用的表名输出到一个选择框?-Delphi资料

procedure TForm1.ComboBox1Change(Sender: TObject);

begin

Session.GetTableNames(ComboBox1.Text

''

False

False

ComboBox2.Items);

Table1.DatabaseName := ComboBox1.Text;

end;

However

GetTableNames also return a query. so

when the user click on the query

the program crashed...

答:

You seem a little confused between Databases and Tables.

In Delphi

a database refers to a collection of tables

and typically

refers to a directory.

First get a list of databases

Session.GetAliasNames(AliasComboBox.Items);

Now get the tablenames using the selected Alias

Session.GetTableNames(AliasComboBox.Text

'*.db'

False

False

TableComboBox.Items);

Then set the DataBaseName and TableName properties

Table1.DatabaseName := AliasComboBox.Text;

Table1.TableName := TableComboBox.Text;

备案号:鲁ICP备13029499号-2 说三道四 www.s3d4.cn 说三道四技术文摘