with TAdoQuery.Create(nil) do try sSQL := 'SELECT * FROM 表名 WHERE 0 = 1 '; SQL.Clear; SQL.Add(sSQL); Open; 字段数 := FieldCount; for i := 0 to FieldCount - 1 do begin ShowMessage(Fields.Field[i].FieldName);//字段名 end; finally Free; end;
1. Sql语句 select name from syscolumns where id in (select id from sysobjects where name = '表名' 2. http://community.csdn.net/Expert/topic/3497/3497785.xml?temp=.4410517
有这个就行了 select * from syscolumns where ID=object_ID('表名') 这样就OK了
select name from syscolumns where id in (select id from sysobjects where name = '表名'
try
sSQL := 'SELECT * FROM 表名 WHERE 0 = 1 ';
SQL.Clear;
SQL.Add(sSQL);
Open;
字段数 := FieldCount;
for i := 0 to FieldCount - 1 do
begin
ShowMessage(Fields.Field[i].FieldName);//字段名
end;
finally
Free;
end;
Sql语句
select name from syscolumns where id in (select id from sysobjects where
name = '表名'
2.
http://community.csdn.net/Expert/topic/3497/3497785.xml?temp=.4410517
select * from syscolumns where ID=object_ID('表名')
这样就OK了
name = '表名'