% vpaginax = Request("pagina") if trim(vpaginax) = "" or isnull(vpaginax) then vpaginax = "1" end if vtipo ="" vtipo = Request("tipo") vfornecedor = Request("fornecedor") if trim(vfornecedor) = "" then vfornecedor = Request.Form ("fornecedor") end if vindice = "PRECO_EXIBICAO" if Request("indice") <> "" then vindice = Request("indice") end if ' vbusca = Request.Form ("buscar") Set OBJdbConnection = Server.CreateObject("ADODB.Connection") OBJdbConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/banco/okey.mdb") & ";Persist Security Info=False" if trim(request("caixa_busca")) = "" then SQL = "SELECT * FROM TABELA_PRECO WHERE FORNECEDOR ='" & vfornecedor & "' " & " ORDER BY " & vindice Set RS=OBJdbConnection.Execute(SQL) else arquivo = "tabela_preco" vpaginax = Request("pagina") if trim(vpaginax) = "" or isnull(vpaginax) then vpaginax = "1" end if vb=request("caixa_busca") vbusca = "caixa_busca=" & request("caixa_busca") vbusca = replace(vbusca," ","+") vbuscapor = "descricao" do while right(vbusca,1) = "+" if right(vbusca,1) = "+" then vbusca = mid(vbusca,1,len(vbusca)-1) end if loop b = trim(vbusca) IF b = "" THEN b= "*" ELSE b= vbusca END IF b = trim(mid(b,13,100)) total = instr(1,b,"+") if total = 0 then x1 = trim(mid(b,total+1,100)) if trim(vbuscapor) = "descricao" then condicao = " WHERE INSTR(1,descricao,'" & x1 & "')>0" end if if trim(vbuscapor) = "partnumber" then condicao = " WHERE INSTR(1,codigo,'" & x1 & "')>0" end if else condicao =" WHERE " do while total > 0 total = instr(1,b,"+") if total >0 then x1 = mid(b,1,total-1) else x1 = trim(mid(b,1,100)) end if if trim(vbuscapor) = "descricao" then condicao = condicao & " INSTR(1,descricao,'" & x1 & "')>0" end if if trim(vbuscapor) = "partnumber" then condicao = condicao & " INSTR(1,codigo,'" & x1 & "')>0" end if b=mid(b,total+1,100) if trim(b) <> "" and total > 0 then condicao = condicao & " AND " end if loop end if IF mid(TRIM(UCASE(vfornecedor)),1,5) <> "TODOS" THEN condicao = condicao & "AND fornecedor = '" & vfornecedor & "'" END IF 'Response.Write condicao Set OBJdbConnection = Server.CreateObject("ADODB.Connection") OBJdbConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/banco/okey.mdb") & ";Persist Security Info=False" SQL = "SELECT * FROM " & ARQUIVO & condicao & " ORDER BY " & vindice Set RS=OBJdbConnection.Execute(SQL) end if if RS.EOF then erro = "1" vap = "0" & "^" varray = Split(vap,"^") else erro = "0" vtotalregistros = 0 vtotalf=0 do while not rs.eof vtotalregistros = vtotalregistros + 1 rs.movenext loop vfor = ((vpaginax -1) * 30) + 1 if vfor = 1 then rs.movefirst else rs.movefirst for y = 1 to vfor -1 if not rs.eof then rs.movenext end if next end if vtpag = ROUND(vtotalregistros / 30,1) if vtpag > int(vtpag) then vtpag = int(vtpag) + 1 end if vap = "" if vtpag = 0 then vtpag = 1 end if for y = 1 to vtpag vap = vap & y & "^" next 'Response.Write "PAGINAS : " & vtpag if trim(vap) = "" or trim(vap) = "^" then vap = "1" & "^" end if varray = Split(vap,"^") end if if trim(Session("email_carrinho")) <> "" then vrevenda = Session("email_carrinho") else vrevenda = "" end if %>