日期:2014-05-17  浏览次数:21142 次

請高手幫忙解釋這段代碼!!!
if     len(dt_start_date) <1   and   len(dt_end_date) <1   then
if   str_file_type= "all "   and   str_dept_no= "all "   and   str_pers_name= " "   and   str_file_pro= "all "   then
str_sql= "select   *   from   VIEW_OA_FILE_TYP_USER   where   'a '= 'a ' "
else
str_sql=replace(str_sql, "write_date> = ' "&dt_start_date& " 'and   write_date <= ' "&dt_end_date& " 'and ", " ")  
end   if
end   if
select   case   request( "type ")
case   "in "
str_sql=replace(str_sql, "where ", "   where   in_dept= ' "&strDept& " '   and   ")
case   "out "
str_sql=replace(str_sql, "where ", "   where   out_dept= ' "&strDept& " '   and   ")
end   select
'*****************排序
if   len(str_click_mark) <1   then
str_click_mark=0
end   if
if   clng(str_click_mark)   mod   2   =0   then
if   len(trim(str_sort_type)) <1   then
str_sql   =   str_sql   &   "   order   by   file_id "   &   "   desc "
else
str_sql   =   str_sql   &   "   order   by   "   &str_sort_type   &   "   desc "
end   if
else
if   len(str_sort_type) <1   then
str_sql   =   str_sql   &   "   order   by   file_id "   &   "   asc "
else
str_sql   =   str_sql   &   "   order   by   "   &str_sort_type   &   "   asc "
end   if
end   if
rs.open(str_sql),,3,1
if   not   rs.eof   then

------解决方案--------------------
if len(dt_start_date) <1 and len(dt_end_date) <1 then
如果变量dt_start_date的长度小于1,且变量dt_end_date的长度小于1,那么

if str_file_type= "all " and str_dept_no= "all " and str_pers_name= " " and str_file_pro= "all " then
如果变量str_file_type的值为 "all ",且变量str_dept_no的值为 "all ",且变量str_pers_name的值为 " ",且变量str_file_pro的值为 "all ",那么

str_sql= "select * from VIEW_OA_FILE_TYP_USER where 'a '= 'a ' "
变量str_sql的值为 "select * from VIEW_OA_FILE_TYP_USER where 'a '= 'a ' "

else
否则

str_sql=replace(str_sql, "write_date> = ' "&dt_start_date& " 'and write_date <= ' "&dt_end_date& " 'and ", " ")
将变量str_sql中的字符串 "write_date> = ' "&dt_start_date& " 'and write_date <= ' "&dt_end_date& " 'and "替换成为 " "

end if
结束如果

end if
结束如果