|
免费内容:
sql="Select BellID,SongName,SingerName,Price,AvailabilityDate,SpName,Region,DownloadsNumber,DownloadsDate,YearMonth from DownloadsData where"
if music<>"" then sql=sql&" SongName like '%"&music&"%' AND"
if m_name<>"" then sql=sql&" SingerName like '%"&m_name&"%' AND"
if spname<>"" then sql=sql&" SpName like '%"&spname&"%' AND"
if region<>"" then sql=sql&" Region like '%"®ion&"%' AND"
if date1<>"" and date2="" then sql=sql&" YearMonth ='"&date1&"-"&day1&"' AND"
if date2<>"" and date1="" then sql=sql&" YearMonth ='"&date2&"-"&day1&"' AND"
if date1<>"" and date2<>"" then sql=sql&" YearMonth >= '"&date1&"-"&day1&"' AND YearMonth <= '"&date2&"-"&day1&"' AND"
DownloadsDate>'"&month1&"' AND"
if right(sql,5)="WHERE" then sql=left(sql,clng(len(sql))-5) '解决所有参数都为空的情况
if right(sql,3)="AND" then sql=left(sql,clng(len(sql))-3) '去掉参数最后的and
用这个吧?我看比你的要好看明白的多,也没有你的麻烦
想怎么查询就怎么查询
这只是一种方法 |
|