Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 18

Discussione: dove metto la pwd?

  1. #1

    dove metto la pwd?

    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()

    %>
    Parafarmacia online, tantissimi prodotti tutti in un click

  2. #2
    Nella connessione al tuo DB.

    codice:
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDB: Database Password=MyDbPassword;"

  3. #3
    Ho inserito quello che mi hai gentilmente suggerito ma ora l'errore è :

    Microsoft JET Database Engine error '80004005'

    Could not find installable ISAM.

    /search.asp, line 122

    dove la linea 122 è

    RetRS.Open Session("StrSQL"), DBName,adOpenKeyset, adLockOptimistic
    Parafarmacia online, tantissimi prodotti tutti in un click

  4. #4
    Vediamo cosa hai scritto.

  5. #5
    <%dbname=""Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&servermappath(mdb-database/ricette.mdb);Jet OLEDB: Database Password=05271;"%>
    Parafarmacia online, tantissimi prodotti tutti in un click

  6. #6
    <%dbname=""Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&servermappath(mdb-database/ricette.mdb);Jet OLEDBatabase Password=05271;"%>

    C'era uno spazio non previsto, prova così.

  7. #7
    L'errore non cambia,

    sono arrivato a scrivere così:

    <%dbname="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&servermappath(mdb-database/ricette.mdb)&";Jet OLEDBDatabase Pwd=05271;"%>

    E mi da questo errore:

    Microsoft VBScript runtime error '800a01a8'

    Object required: 'ricette'

    /searchsettings.inc, line 1
    Parafarmacia online, tantissimi prodotti tutti in un click

  8. #8
    qui la connessione non c'entra.

    cmq la stringa di connessione è sbagliata :

    Jet OLEDBDatabase Pwd=05271;

    devi inserire i due punti ":" tra OLEDB e Database.

  9. #9
    Originariamente inviato da Vitacillina
    qui la connessione non c'entra.

    cmq la stringa di connessione è sbagliata :

    Jet OLEDBDatabase Pwd=05271;

    devi inserire i due punti ":" tra OLEDB e Database.
    Oppure prova questa:

    codice:
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=;"

  10. #10
    posso scrivere come voglio ma l'errore non cambia...
    Parafarmacia online, tantissimi prodotti tutti in un click

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.