我用adoquery组件连到sqlserver数据库中后,执行以下语句
select name from master.dbo.sysdatabases where DBId>6 Order By Name
请问如何将查询到的表名取出来,谢谢!

解决方案 »

  1.   

    var
    strname:string;beginquery.first;
    while not query.eof do
    begin
    strname:=query.fieldbyname('name').Astring;////下面假设用户输入的数据是在edit1中,进行比较的过程如下if Trim(edit1.text)=trim(strname) then /////如果相等,就如何操作具体根据你的需要去写代码begin
    ....
    end else  ////////如果不等又如何如何操作,具体根据你的需要去写代码
    begin
    ....end;
    end;end;
      

  2.   

    再到数第二个end 前面加 query.next ;
      

  3.   

    建议楼主用ADO连接对象,adoconnection连接上后,自带了该属性,能取得所有的表名
    并赋予一字符串数组
    adoconnection1.GetTableNames(字符串变量名,false);
      

  4.   

    adoconnection1.GetTableNames(Listbox1.Items,false);
    把所有表明放在listbox框中
      

  5.   

    搞定,多谢 lovend(颓废之吻)