SQL 的表结构
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tabdatabase]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[tabdatabase]
GO
CREATE TABLE [dbo].[tabdatabase] (
[fitem_id] [int] NOT NULL ,--序号
[fitem_name_e] [varchar] (20) NOT NULL ,--英文名
[fitem_name_c] [varchar] (40) NULL ,--中文名
[fparent_id] [int] NOT NULL ,--父节点
[fitem_level] [int] NULL --层次
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tabdatabase] WITH NOCHECK ADD
CONSTRAINT [PK_tabdatabase] PRIMARY KEY NONCLUSTERED
(
[fitem_id]
) ON [PRIMARY]
GO
CREATE INDEX [IX_tabdatabase] ON [dbo].[tabdatabase]([fitem_name_c]) ON [PRIMARY]
GO
CREATE INDEX [IX_tabdatabase_1] ON [dbo].[tabdatabase]([fitem_name_e]) ON [PRIMARY]
GO
DELPHI中代码
ADODataSet1.Close;
ADODataSet1.CommandText := '';
ADODataSet1.CommandText := 'select * from tabdatabase order by fitem_name_e';
ADODataSet1.Open;
dxDBTreeView1.DataSource := DataSource1;
dxDBTreeView1.KeyField := 'fitem_id';
dxDBTreeView1.ParentField := 'fparent_id';
dxDBTreeView1.ListField := 'fitem_id';
dxDBTreeView1.DisplayField := 'fitem_name_e';
dxDBTreeView1.Images := Imgtv;
dxDBTreeView1.ImageIndexField := 'fitem_level';
dbedit1.DataSource := DataSource1;
dbedit1.DataField := 'fitem_id';