———————————————–User/setnextoptions.asp——————————————- ‘注意ReqSql response.Charset=”gb2312″ SelectName = NoSqlHack(trim(request(”SelectName”))) ReqSql = trim(request(”ReqSql”)) EquValue = NoSqlHack(trim(request(”EquValue”))) sType = trim(request(”sType”)) if not isnumeric(sType) then sType = 1 if SelectName = “” then SelectName = “NoName_Sys” ‘看看你是否为空 if instr(lcase(ReqSql),”select “)=0 then response.Write(”系统错误,请联系管理员。”) response.End() ———————————— LCase 函数 返回字符串的小写形式 ————————————– InStr 函数 返回某字符串在另一字符串中第一次出现的位置。 InStr([start, ]string1, string2[, compare]) 参数 start 可选项。数值表达式,用于设置每次搜索的开始位置。如果省略,将从第一个字符的位置开始搜索。如果 start 包含 Null,则会出现错误。如果已指定 compare,则必须要有 start 参数。 string1 必选项。接受搜索的字符串表达式。 string2 必选项。要搜索的字符串表达式。 ———————————————————————– 如果没有select则报错~ end if optionstr = Get_NextOptions(ReqSql,EquValue,sType) ‘传到Get_NextOptions if optionstr = “” then optionstr = “[无]” response.Write(” “&vbNewLine) response.Write(”不限制“&vbNewLine) response.Write(optionstr) response.Write(” “&vbNewLine)...
———————————————–User/setnextoptions.asp——————————————- ‘注意ReqSql response.Charset=”gb2312″ SelectName = NoSqlHack(trim(request(”SelectName”))) ReqSql = trim(request(”ReqSql”)) EquValue = NoSqlHack(trim(request(”EquValue”))) sType = trim(request(”sType”)) if not isnumeric(sType) then sType = 1 if SelectName = “” then SelectName = “NoName_Sys” ‘看看你是否为空 if instr(lcase(ReqSql),”select “)=0 then response.Write(”系统错误,请联系管理员。”) response.End() ———————————— LCase 函数 返回字符串的小写形式 ————————————– InStr 函数 返回某字符串在另一字符串中第一次出现的位置。 InStr([start, ]string1, string2[, compare]) 参数 start 可选项。数值表达式,用于设置每次搜索的开始位置。如果省略,将从第一个字符的位置开始搜索。如果 start 包含 Null,则会出现错误。如果已指定 compare,则必须要有 start 参数。 string1 必选项。接受搜索的字符串表达式。 string2 必选项。要搜索的字符串表达式。 ———————————————————————– 如果没有select则报错~ end if optionstr = Get_NextOptions(ReqSql,EquValue,sType) ‘传到Get_NextOptions if optionstr = “” then optionstr = “[无]” response.Write(” “&vbNewLine) response.Write(”不限制“&vbNewLine) response.Write(optionstr) response.Write(” “&vbNewLine) ———————————————————————————————————————- 我们关注下Function Get_NextOptions ———————————————————————————————————————- Function Get_NextOptions(This_Fun_Sql,EquValue,Get_Type) ”’This_Fun_Sql 传入sql语句,EquValue与数据库相同的值如果是则加上selected,Get_Type=1为 Dim Get_Html,This_Fun_Rs,Text On Error Resume Next if instr(This_Fun_Sql,”FS_ME_”)>0 then ’如果有FS_ME_着执行User_Conn.execute set This_Fun_Rs = User_Conn.execute(This_Fun_Sql) else set This_Fun_Rs = Conn.execute(This_Fun_Sql)’如果没有FS_ME_着执行User_Conn.execute end if If Err.Number <> 0 then response.Redirect(”error.asp?ErrCodes= “&Err.description&” 抱歉,传入的Sql语句有问题.或表和字段不存在. “) do while not This_Fun_Rs.eof select case cstr(Get_Type) case “1″ ” if instr(This_Fun_Sql,”,”) >0 then Text = This_Fun_Rs(1) else Text = This_Fun_Rs(0) end if if trim(EquValue) = trim(This_Fun_Rs(0)) then Get_Html = Get_Html & ““&Text&”“&vbNewLine else Get_Html = Get_Html & ““&Text&”“&vbNewLine end if case else exit do : Get_FildValue_List = “Get_Type值传入错误“&vbNewLine : exit Function end select This_Fun_Rs.movenext loop This_Fun_Rs.close Get_NextOptions = Get_Html End Function ———————————————————————————————————————- 小K来解说下 ReqSql传入字符,经过简单的处理,把字符传入Get_NextOptions,对是否有FS_ME判断…… 当有FS_ME就会去admin的数据库执行查询(因为他有多个数据库……),如果没有就会去user的数据库执行查询。 FS_ME是啥? FS_ME是字段名FS_ME_Admin的前半部分 可以看出 4.0 sp5 暂无