Ciao a tutti ho un problema, creo una query di ricerca con uno script che ho trovato da qualche parte, ma il db a cui mi connetto è protetto da pwd, cosa non prevista dallo script
Dove metto la password????
ecco il codice:



<%

Sub Search()
Dim SearchString
Dim StrSQL
Dim RetRS
Dim ContentToWrite
Dim X
Dim WordLocation
Dim Content
Dim PrevText
Dim RecNum
Dim RecLO
Dim RecHI
Set RetRS = Server.CreateObject("adodb.recordset")
Dim isAND
Dim ArraySTR()
Dim ResText
Dim WordCount

textStr = Request.QueryString("s")



if textstr <> "" then
session("searchString") = textStr
else
textstr = session("searchstring")
end if
if len(textStr) < 3 then
contenttoWrite = "

<center>Non puoi effettuare ricerche per termini di meno di tre lettere.</center>"

else

if textStr <> "" then

ResText = "

<center><font face='arial' style='font-size: 10pt'>Ecco i risultati per: " & textStr & "</center>"
textStr = Replace(textStr,"'", "''")
Dim charCheck
for CharCheck = 35 to 38
textSTR = Replace(textSTR,chr(CharCheck),"")
next

for CharCheck = 40 to 47
textSTR = Replace(textSTR,chr(CharCheck),"")
next

for CharCheck = 58 to 64
textSTR = Replace(textSTR,chr(CharCheck),"")
next

for CharCheck = 91 to 96
textSTR = Replace(textSTR,chr(CharCheck),"")
next

textSTR = Replace(textSTR,chr(126),"")
textSTR = Replace(textSTR,chr(33),"")
SeperatorSTR = " "

Dim pos1
Dim pos2
Dim wordLen
x = 1
pos1 = 1
pos2 = instr(1,textSTR,SeperatorSTR)
if pos2 = 0 then pos2 = len(textstr): pos1 = 0
Redim Preserve ArraySTR(x)
wordLen = pos2 - pos1
ArraySTR(0) = mid(textstr,1, wordLen)

While pos1 <> 0
pos1 = pos2
pos2 = instr(pos2+1,textSTR,SeperatorSTR)
if pos2 = 0 then
if pos1 > 0 then
pos2 = len(textstr) + 1
end if
end if

if pos2 <> 0 then
if pos1 <> 0 then
Redim Preserve ArraySTR(x)
wordLen = pos2 - pos1 - 1
ArraySTR(x) = mid(textstr,pos1 + 1,wordLen)
x=x+1
End if
End if
if pos2 => len(textstr) then pos1 = 0

Wend

WordCount = x
strSQL = "Select TOP 100 * from ricette where preparazione like '%" & ArraySTR(0) & "%'"

for x = 0 to Wordcount - 1
if lcase(ArraySTR(x)) <> "and" then
if x > 0 then
strSQL = StrSQL & " AND content like '%" & ArraySTR(x) & "%'"
end if
end if
next

strSQL = StrSQL & ";"
end if



if StrSQL <> "" then
session("StrSQL") = StrSQL&
end if


if session("StrSQL") <> "" then

wPageToDisplay = Request.QueryString("bm")


if wPageToDisplay = "" then wPageToDisplay = 1

RetRS.Open Session("StrSQL"), DBName,adOpenKeyset, adLockOptimistic
RetRS.PageSize = 10

if not RetRS.EOF then
RetRS.MoveFirst
RetRS.AbsolutePage = wPageToDisplay
ContentToWrite = ResText
for x = 1 to RetRS.PageSize
if RetRS.EOF = true then exit for
if wpagetodisplay <> 1 then
recnum = x
if recnum = 10 then
recnum = 0
recnum = wPageToDisplay & recnum
else
recnum = wPageToDisplay - 1 & recnum
end if
if x = 10 then RecHI = recnum
if x = 0 then RecLO = recnum
else
recnum = x
end if

RecHI = recnum
if x = 1 then RecLO = recnum
ContentToWrite = ContentToWrite & "

" & recNum & "." & RetRS("titolo") & ""
Content = retRS("preparazione")
arraySTR(0) = replace(arraySTR(0),"''","'")
wordlocation = InStr(1,ucase(content),ucase(arraySTR(0)))

if wordlocation <> 0 then
PrevText = "..." & mid(content, wordlocation,150) & "..."
for z = 0 to wordcount - 1
if arrayStr(z) <> "and" then
arraySTR(z) = replace(arraySTR(z),"''","'")
Prevtext = replace(lcase(prevtext),lcase(ArrayStr(z)),"<span style=background-color:#FF0000><font color=#FFFF00>" & ArrayStr(z) & "</font></span>",1,-1,0)
end if
next
PrevText = PrevText & "
" & RetRs("titolo")& ""
else
PrevText = "No Preview Text Available"
end if

ContentToWrite = ContentToWrite & "
<SR>" & preVText & "</SR>"
RetRS.MoveNext
next

contenttowrite = contenttowrite + "

Risultati " & RecLO & "-" & RecHI & " di " & RetRS.RecordCount & " trovati"

ContentToWrite = ContentToWrite & "

"
if wPagetoDisplay > 1 then
ContentToWrite = ContentToWrite & "<a href=search.asp?bm=" & wPageToDisplay - 1 & ">&lt;&lt;Previous" & "</a>"
end if
Dim myPageCount
Dim myRemainder
if RetRS.PageCount > 1 then
For myPageCount = 1 to retRS.PageCount

if myPageCount = cint(wPageToDisplay) then
ContentToWrite = ContentToWrite & "<a href=search.asp?bm=" & myPageCount & ">" & myPageCount & "</a>"
else
ContentToWrite = ContentToWrite & "<a href=search.asp?bm=" & myPageCount & ">" & myPageCount & "</a>"
end if
myRemainder = mypagecount mod 20
if myRemainder = 0 then ContentToWrite = ContentToWrite & "
"
Next
End if

if cint(wPageToDisplay) < RetRS.PageCount then
ContentToWrite = ContentToWrite & "<a href=search.asp?bm=" & wPageToDisplay + 1 & ">Next&gt;&gt;" & "</a>"
end if

ContenttoWrite = ContentToWrite & "



"



else
textStr = replace(textSTR,"''","'")
ContenttoWrite = "



[b]<center>Search for " & textStr & " Returned No Matches</center>

[b]"
end if

else
contenttoWrite = "

<center>Nothing to search for.</center>"

end if

End if

%>

<%


End sub



Search()

%>