★★★★★★★★★★ GetTableNames不错,可是他提的东东太多了,我只想要Table名, 不要view名,怎么办?★★★★★★★★★★

gototop99 2003-06-09 10:58:46
如何用组件区分表名和视图名????
...全文
26 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
gototop99 2003-06-10
  • 打赏
  • 举报
回复
uupp!!!
gototop99 2003-06-09
  • 打赏
  • 举报
回复
ihihonline(小小->沉沦中..........) 谢谢,

我正在看源码,不知道用 BDE 可不可以?????
tpmao 2003-06-09
  • 打赏
  • 举报
回复
同意,还是SQLSERVER里方便!!!!!

select name from sysobjects where xtype = 'U'
gototop99 2003-06-09
  • 打赏
  • 举报
回复
先谢谢 firetoucher(风焱),

那么sybase数据库怎么办呢???
ihihonline 2003-06-09
  • 打赏
  • 举报
回复
procedure TADOConnection.GetTableNames(List: TStrings;
SystemTables: Boolean);
var
TypeField,
NameField: TField;
TableType: string;
DataSet: TADODataSet;
begin
CheckActive;
DataSet := TADODataSet.Create(nil);
try
OpenSchema(siTables, EmptyParam, EmptyParam, DataSet);
TypeField := DataSet.FieldByName('TABLE_TYPE'); { do not localize }
NameField := DataSet.FieldByName('TABLE_NAME'); { do not localize }
List.BeginUpdate;
try
List.Clear;
while not DataSet.EOF do
begin
TableType := TypeField.AsString;
if (TableType = 'TABLE') or (TableType = 'VIEW') or { do not localize }
(SystemTables and (TableType = 'SYSTEM TABLE')) then { do not localize }
List.Add(NameField.AsString);
DataSet.Next;
end;
finally
List.EndUpdate;
end;
finally
DataSet.Free;
end;
end;

看一下,这儿是源码。
其中:
(TableType = 'TABLE') or (TableType = 'VIEW')就决定了它会找View,你可以自己写一个方法去实现,只要去掉TableType = 'VIEW' 就可以了。

----------------
沉沦中..........
firetoucher 2003-06-09
  • 打赏
  • 举报
回复
不是,因为这条语句其他数据库不支持:(
--------------------------------------
看!
那支正飞向太阳的蛾子.....
就是我!
--------------------------------------
gototop99 2003-06-09
  • 打赏
  • 举报
回复
是不是要根据不同的数据库来判断啊?????
firetoucher 2003-06-09
  • 打赏
  • 举报
回复
在sql server 中你可以使用sql语句
select name from sysobjects where xtype = 'U'
--------------------------------------
看!
那支正飞向太阳的蛾子.....
就是我!
--------------------------------------
gototop99 2003-06-09
  • 打赏
  • 举报
回复
不知道用 BDE 可不可以?????
Delphi 7.1 Update Release Notes=======================================================This file contains important supplemental and late-breakinginformation that may not appear in the main productdocumentation, and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed before installing this update. =====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE - DATASNAP - DBGO (ADO COMPONENTS) - dbExpress - dbExpress COMPONENTS AND DB VCL - dbExpress CORE DRIVER AND METADATA - dbExpress VENDOR ISSUES - dbExpress CERTIFICATION - WEB SNAP - ACTIVEX - COMPILER - RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* This update can not be applied to Delphi 7 Architect Trial version. * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and launch the d7_ent_upd1.exe file appropriate for your locale.* To install this update from the Web, double-click the self-executing installation file and follow the prompts. * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only to the English version of Delphi 7. There are separate updates for the German, French and Japanese ver

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧