相关代码如下:
if radiobutton1.Checked then
      begin
      sql:='select *from money where riqi='+''''+combobox1.Text+'''';
      end
      else if radiobutton2.Checked then
              begin
              sql:='select *from money where xiangmu='+''''+combobox2.Text+'''';
              end
              else if radiobutton3.Checked then
                      begin
                      sql:='select *from money where money='+''''+combobox3.Text+'''';
                      end;

解决方案 »

  1.   

    if radiobutton1.Checked then 
      begin 
          sql:= 'select * from money where riqi='''+combobox1.Text+''''; 
      end 
    else if radiobutton2.Checked then 
      begin 
          sql:= 'select * from money where xiangmu='''+combobox2.Text+''''; 
      end 
    else if radiobutton3.Checked then 
      begin 
          sql:= 'select * from money where money='''+combobox3.Text+''''; 
    end;
      

  2.   

    sql:= 'select * from money where money = '''+combobox3.text+'''';
    看看这样如何最好是调试下,看看SQL的值是什么,比较直观
      

  3.   

    呵呵。。没注意看,moeny 是 SQL的关键字,所以导致错误。
    你换个名吧
      

  4.   

    if radiobutton1.Checked then 
          sql:= 'select *from money1 where riqi= '+ ' ' ' '+combobox1.Text+ ' ' ' '
          else if radiobutton2.Checked then 
                  sql:= 'select *from money1 where xiangmu= '+ ' ' ' '+combobox2.Text+ ' ' ' '
                  else if radiobutton3.Checked then 
                          sql:= 'select *from money1 where money= '+ ' ' ' '+combobox3.Text+ ' ' ' '; 
    楼上的正确,确实是money的问题换成money1试试,另给你简化了一下句子,有太多的begin end了
      

  5.   

    if radiobutton1.Checked then 
          sql:= 'select * from money where riqi= '+ quotedstr(combobox1.Text)
          else if radiobutton2.Checked then 
              sql:= 'select * from money where xiangmu= '+ quotedstr(combobox1.Text)
                 else if radiobutton3.Checked then 
                          sql:= 'select * from money where money= '+ quotedstr(combobox1.Text);另外 二楼的也正解!
      

  6.   

    你的程序至少有以下错误
    1、select *from 中*与from之间必须有空格,这是你出现“FROM子句语法错误”的直接原因
    2、money是SQL系统关键字,必须用[]包括
    3、如果money属于数值类型的字段,那么 combobox3.Text 部分不能用引号
    4、combobox3.Text部分没有进行空值判断部分,假如combobox3.Text是空的,那么这条语句根本不是这么写
    5、不算错误的错误,combobox1.Text部分应该用QuotedStr()否则如果combobox1.Text里面有单引号那就乱套了。
    if radiobutton1.Checked then 
          begin 
          sql:= 'select * from [money] where riqi='+QuotedStr(combobox1.Text); 
          end 
          else if radiobutton2.Checked then 
                  begin 
                  sql:= 'select * from [money] where xiangmu='+QuotedStr(combobox2.Text); 
                  end 
                  else if radiobutton3.Checked then 
                          begin 
                          sql:= 'select * from [money] where [money]='+combobox3.Text; 
                          end;