var
ts:Tstrings;
i:integer;
begin
ts:=Tstringlist.Create;
//adoconnection1.GetTableNames(ts,false);
//for i:=0 to ts.Count-1 do
// showmessage('第'+inttostr(i+1)+'个表名是'+ts.Strings);
adoconnection1.GetFieldNames('stu',ts);
for i:=0 to ts.Count-1 do
showmessage('第'+inttostr(i+1)+'个字段名是'+ts.Strings);
end;
//注:用session控件也可以完成以上的功能
ts:Tstrings;
i:integer;
begin
ts:=Tstringlist.Create;
//adoconnection1.GetTableNames(ts,false);
//for i:=0 to ts.Count-1 do
// showmessage('第'+inttostr(i+1)+'个表名是'+ts.Strings);
adoconnection1.GetFieldNames('stu',ts);
for i:=0 to ts.Count-1 do
showmessage('第'+inttostr(i+1)+'个字段名是'+ts.Strings);
end;
//注:用session控件也可以完成以上的功能
Delphi中获取字段名
本文介绍了一段使用Delphi代码来获取指定表('stu')所有字段名称的方法,并通过消息框展示每个字段的名字。该示例展示了如何利用ADO组件进行数据库交互。
3447

被折叠的 条评论
为什么被折叠?



