查询用的SQL
dim MAJOR_IFEA,APPLY_TIME,APPLY_TIME_END,WISH_FINISH_TIME,WISH_FINISH_TIME_END,IT_UNDERTAKER,ACTMCONT,time,time1,time2,time3
MAJOR_IDEA=Trim(request.form("MAJOR_IDEA"))
APPLY_TIME=Trim(request.form("APPLY_TIME"))
APPLY_TIME_end=Trim(request.form("APPLY_TIME"))
WISH_FINISH_TIME=Trim(request.form("WISH_FINISH_TIME"))
WISH_FINISH_TIME_end=Trim(request.form("WISH_FINISH_TIME"))
IT_UNDERTAKER=Trim(request.form("IT_UNDERTAKER"))
ACTMCONT=Trim(request.form("ACTMCONT"))
sql="select * from REQUIRE_BILL where 1=1"
if MAJOR_IDEA <>"" then
sql=sql&"and MAJOR_IDEA like '%"& MAJOR_IDEA &"%'"
end if
if APPLY_TIME <>"" then
time=cint(APPLY_TIME)
else
time=0
end if
if APPLY_TIME_end <>"" then
time1=cint(APPLY_TIME_end)
else
time1=0
end if
if time<>0 and time1<>0 then
sql=sql&"select * from REQUIRE_BILL where CONVERT(int,MONTH(date))>="&cstr(time)&" and CONVERT(int,MONTH(date))<="&cstr(time1)&""
end if
if time<>0 and time1=0 then
sql=sql&"select * from REQUIRE_BILL where CONVERT(int,MONTH(date))>="&cstr(time)&""
end if
if time=0 and time1<>0 then
sql=sql&"select * from REQUIRE_BILL where CONVERT(int,MONTH(date))<="&cstr(time1)&""
end if
if WISH_FINISH_TIME <>"" then
time2=cint( WISH_FINISH_TIME)
else
time2=0
end if
if WISH_FINISH_TIME_end <>"" then
time3=cint(APPLY_TIME_end)
else
time3=0
end if
if time2<>0 and time3<>0 then
sql=sql&"select * from REQUIRE_BILL where CONVERT(int,MONTH(date))>="&cstr(time2)&" and CONVERT(int,MONTH(date))<="&cstr(time3)&""
end if
if time2<>0 and time3=0 then
sql=sql&"select * from REQUIRE_BILL where CONVERT(int,MONTH(date))>="&cstr(time2)&""
end if
if time=0 and time3<>0 then
sql=sql&"select * from REQUIRE_BILL where CONVERT(int,MONTH(date))<="&cstr(time3)&""
end if
if IT_UNDERTAKER <>"" then
sql=sql&"and IT_UNDERTAKER = '"& IT_UNDERTAKER &"'"
end if
sqlstr="select * from REQUIRE_LOG where 1=1"
if ACTMCONT<>"" then
sqlstr=sqlstr&"and ACTMCONT ='"& ACTMCONT &"'"