你只要在COMBOBOX的CHANGE事件做就可以了,根据COMBOBOX中的条件SELECT呀
那么DBEDIT的DATASOURCE为一个QUERY呀!!!!!

解决方案 »

  1.   

    你要想好了,这种方法的可用性因为学生多了就会combobox拉的很长也不方便的。具体实现
                   在ComboboxClick事件中写入query : select * from table where code='''+Combobox1.text+'''
    table : Table1.locate("code",combobox1.text,[])
    学号必须是唯一的
      

  2.   

    能不能给我写一下select语句呀,谢谢了dbedti的datasource是table行不行呀
      

  3.   

    我还是说清楚一点吧
    首先你可以把学号全装到COMBOBOX中,当然也可不装进去
    query1.close;
    query1.sql.clear;
    query1.sql.add('select * from your_table');
    qury1.open;
    if query1.recordcount>o then
    begin
    while not query1.eof do
    begin
    combobox1.additem(query1.fieldbyname('id').asstring);
    query1.next
    end;  
    end;//DBedit1的DataSource设为Query1
    在Combobox1.Change事件中,或你点击另一BUTTON来实现对DBEDIT的控件
    query1.close;
    query1.sql.clear;
    query1.sql.add('select * from your_table where id=:tmp');
    query1.parambyname('tmp').asstring:=trim(combobx1.text);
    qeury1.open;
    你去试一下吧!!!!!!
    不管有没有用,试一下总会有点帮助的!!!!
      

  4.   

    sql.add('select * from table where 学号='''+combobox1.text+'''');
      

  5.   

    phosphor(蜗牛) :你好
    在comboboxclick事件中写代码能使dbedit跟着变吗
    ??