select 字段1,字段2,字段3,字段4....

解决方案 »

  1.   

    csql="select * from utble "
    if a1<>"" Then
       csql=csql+" where a1=" & a1 
    end if
    if a2<>"" Then
       if instr(csql,"where")>0 Then
          csql=csql+" and a2=" & a2
       else
          csql=csql+" where a2=" & a2
       en if
    end if
    .........
    ........
    ........
    if a20<>"" Then
       if instr(csql,"where")>0 Then
          csql=csql+" and a20=" & a20
       else
          csql=csql+" where a20=" & a20
       en if
    end ifcslq=csql & " order by a1 DESC,a2,a3"
    RS.open csql,conn,1,1