完成功能是在数据库省份表里查出省份的记录,然后插到 Combobox 里,总是提示一个错误:
raised exception classic EOLeException with message,BOF 或 EOF 中有一个是真,或者当前的记录已删除,
所需的操作是一个当前的记录,哪位大侠帮我看看?
with ADOQuery1 do
  begin
    close;
    SQL.Clear;
    SQL.Add('select F_province from T_ZJK_SF');   //在省份表里查出省份记录;
    Open;
  end;
  if ADOQuery1.RecordCount>0 then
    while ADOQuery1.FindNext do
    begin
      ComboBox1.Items.Add(ADOQuery1.fieldbyname('F_Province').AsString);
      ADOQuery1.Next;
    end
  else
    ShowMessage('查询失败!');

解决方案 »

  1.   


    试试这样。。
    if ADOQuery1.RecordCount>0 then 
    begin
        while not ADOQuery1.eof do 
        begin 
          ComboBox1.Items.Add(ADOQuery1.fieldbyname('F_Province').AsString);  
        end; 
        ADOQuery1.Next;
    end
      else 
        ShowMessage('查询失败!');
      

  2.   

    对了,你还要加个清除动作,否则ComboBox1里的数据会一直累加的。
    ComboBox1.Items.clear;
    ComboBox1.Items.Add(ADOQuery1.fieldbyname('F_Province').AsString);