sql="select * from 标准数据 wher 规格型号 = " & trim(text1(8).text) & " and 芯数 = " & trim(text1(9).text) & " and 面积 = " & val(text1(10).text)
Dim MyRs as New Adodb.RecordSet
Set MyRs = MyCon.Execute(sql)
text1(12).text=MyRs("ID")
程序执行至MyCom.Execute(sql)中时,总是说至少一个有一个参数没有指定。不知为什么?哪位高手对于这种多条件查询比较熟悉,望帮小弟一把!

解决方案 »

  1.   

    sql="select * from 标准数据 where 规格型号 = " & trim(text1(8).text) & " and 芯数 = " & trim(text1(9).text) & " and 面积 = " & val(text1(10).text)  where 写错了
      

  2.   

    where 错了
    另外如果字段[规格型号]是字符类型的话要加单引号
    sql="select * from 标准数据 where 规格型号 = '" & trim(text1(8).text) & "' and 芯数 = " & trim(text1(9).text) & " and 面积 = " & val(text1(10).text)
      

  3.   

    我的程序中Where 并不错,这里只不过是打错了。但程序会出错.
      

  4.   

    是这样的sql="select * from 标准数据 wher 规格型号 = '" & trim(text1(8).text) & "'and 芯数 = '" & trim(text1(9).text) & "' and 面积 = " & val(text1(10).text)&"'"    因为每一个变量必须用单引号引起来。比如 select * from 表 where 字段='内容' .这里用变量传递数值,当然单引号也不能丢了!!!!!
      

  5.   

    上面所有的错误在于末尾少了一个     &"'"
      

  6.   

    sql="select * from 标准数据 where( [规格型号] = '" & trim(text1(8).text) & "' and [芯数] = '" & trim(text1(9).text) & "' and [面积] = " & val(text1(10).text)&")"
    Dim MyRs as New Adodb.RecordSet
    Set MyRs = MyCon.Execute(sql)
    text1(12).text=MyRs("ID")
    程序执行至MyCom.Execute(sql)中时,总是说至少一个有一个参数没有指定。不知为什么?哪位高手对于这种多条件查询比较熟悉,望帮小弟一把!
      

  7.   

    sql="select * from 标准数据 where( [规格型号] = '" & trim(text1(8).text) & "' and [芯数] = '" & trim(text1(9).text) & "' and [面积] = " & val(text1(10).text)&")"
    Dim MyRs as New Adodb.RecordSet
    Set MyRs = MyCon.Execute(sql)
    text1(12).text=MyRs("ID")
    程序执行至MyCom.Execute(sql)中时,总是说至少一个有一个参数没有指定。不知为什么?哪位高手对于这种多条件查询比较熟悉,望帮小弟一把!