我有一个字段"金额(元)",查询的时候我想按"金额"去查询,然后显示"金额(元)"这个字段的信息. 有什么办法?请给个代码,谢谢.

解决方案 »

  1.   

    select 金额(元) from 表名
      

  2.   

    我的意思是:select [金额(元)] as 金额 from information where Combo1.Text =text1其中combo1里有金额这项选择,运行时有错误.
      

  3.   

    select  金额(元) as 金额 
      from 表名
    where   金额(元)='条件‘
      

  4.   

    "select [金额(元)] as 金额 from information where " & combol.text & "=" & text1
      

  5.   

    "select [金额(元)] as 金额 from information where " & combol.text & "=" & text1
     运行时,有错误发生.
      

  6.   

    "select 金额(元)as 金额 from information where 金额(元)=" & Val(combol.text)你的查询语句应该是类似这样的。1)《金额(元)》是字段名,你想用《金额》替换《金额(元)》才需要用 as;
    2)你的查询条件是 金额(元)字段的值符合一定的要求(比如:=100,>50.56等等);
    3)你的combol.text 应该是诸如100,200等的数值吧;
    4)combol.text 是字符型的,一般要转换数据类型,甚至要格式化;
    5)具体要看金额(元)的数据类型和格式要求。假设金额(元)字段的数据类型是int,combol.text ="100"查询结果(假设有3条记录的金额(元)]都等于100):金额100100100
      

  7.   

    我的意思是这样的:我要查询金额(元)这个字段,但我的combo1.text里的下拉列表里有金额(注意:不是金额(元))这个选项.我还有个text1是用来输入查询的具体内容的.
    比如我在combo1里选择金额(注意我的字段里只有金额(元),没有金额字段),然后在text1里输入数值,再点击查询,就可以查询到符合combo1=text1
    条件的记录.
    请问该怎么做,谢谢.
      

  8.   

    sqlstr="select 金额(元)as 金额 from information where 金额(元)=" & Val(text1.text)
      

  9.   

    唉,说清楚一点嘛!
    dim SqlStr as string
    if me.combo1.text="金额" then
       if IsNumeric(text1.text)=true then
          SqlStr="select 金额(元)as 金额 from information where 金额(元)=" & Val  (text1.text)
          ......
       end if 
    else
          ......   
    end if
      

  10.   

    报错:语法错误.SqlStr="select 金额(元)as 金额 from information where 金额(元)=" & Val  (text1.text)
      

  11.   

    select [金额(元)] as 金额 from 表 where " & iif(combol.text="金额","金额(元)",combol.text) & "=" & Val(test1.text)
      

  12.   

    "select 金额(元)as 金额 from information where 金额=" & Val(combol.text)