if radiobutton1.Checked then             运行时错误指到这一行
      gxstring:='or';
   if radiobutton2.Checked then
      gxstring:='and';
 ...........
if (edit2.Text <>'')and (edit1.Text='') then   
    query1.SQL.Add(' xm='''+edit2.Text+'''')
else  if (edit2.Text <>'')and (edit1.Text<>'') then
         query1.sql.Add(gxstring+' xm='''+edit2.Text+'''');
我想把and 和or 动态的赋给gxstring,运行时出错,请大家帮忙看看错在哪里

解决方案 »

  1.   

    gxstring:='or';-->gxstring:=' or ';
    gxstring:='and';-->gxstring:=' and ';
    是不是没空格?
      

  2.   

    错误提示could not convert variant of type(null)into (string)
      

  3.   

    前面几行
    if listbox1.SelCount=0 then
          begin
            showmessage(‘请选择输出项’);
            exit;
          end;
      s:=table1.Lookup('bmmc',combobox2.items.strings[combobox2.itemindex],'bmh'); 
       if radiobutton1.Checked then
          gxstring:='or';
       if radiobutton2.Checked then
          gxstring:='and';
      

  4.   

    你的 s 变量类型是不是字符串? 应设置为 Variant;procedure TForm1.Button1Click(Sender: TObject);
    var
      V: Variant;
      A: String;
    begin
      V := Table1.Lookup('State', 'OR', 'Addr1');
      if not (VarType(V) in [varNull]) then 
      begin
        A := V;
        ShowMessage(A);
      end
      else
        ShowMessage('Search unsuccessful!');end;