要用到哪些控件,在哪里写查询语句?在哪里返回查询结果?
具体该如何做?望高人指点!谢谢!!

解决方案 »

  1.   

    控件面板/ADO/TADOQuery控件
    随便找点资料看看,太基础了。
      

  2.   

    if RBName.Checked then
      begin    //查询姓名
        QueryStudent.Close;
        QueryStudent.SQL.Clear;
        QueryStudent.SQL.Add('select StudentName as 姓名,StudentID as 准考证号 from student where StudentName='''+trim(EDName.Text)+'''' );
        QueryStudent.open;
      end
      else
      begin   //查询准考证号
        QueryStudent.Close;
        QueryStudent.SQL.Clear;
        QueryStudent.SQL.Add('select StudentName as 姓名,StudentID as 准考证号 from student where StudentID='''+trim(EDID.Text)+'''' );
        QueryStudent.open;
      end;
      DBGridStuCellClick(DBGridStu.Columns[0]);
    end;
    看不懂勿怪不多做解释了。。
      

  3.   

    adoquery主查询工具
    dbgrid返回查询结果
    datasource连接工具在adoquery里写查询语句
      

  4.   

    adoconnection 连接
    connectstrin:=Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Sale;Data Source=XWL\NETsale就是你的库名,xwl主机名net数据库实例名
    adoquery.connection:=adoconnection
    adoquery.sql.add(你的查询语句)
    adoquery.open