Visualizzazione dei risultati da 1 a 6 su 6
  1. #1

    Problema con connessione al DB

    Ciao, ho un problema con la connessione al database.
    Nella seguente pagina potete vedere l'errore restituito: http://www.hotelwilly.com/cms/pages/
    l'applicazione che sto tentando di istallare dovrebbe permettere di creare un CMS. Nel file di spiegazione dell'istallazione dicono di modificare il percorso al database, che nel mio caso (Aruba) si trova nella cartella mdb-database. Di seguito incollo il codice della connessione sulla pagina /cms/pages/icludes/portalconection.asp

    inizio codice-------------------------
    <%
    dim PortalConnectString
    dim strRootpath,strPortalTitle
    dim fileuploadpath,ImagePath
    dim FromEmail
    dim Show_Title_Above_Content
    dim CMS_Title_Color
    dim CMS_Title_Font
    dim CMS_Background_Color

    PortalConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\mdb-database\CMSDB.mdb;Persist Security Info=False"


    fileuploadpath = "\public\cms\Pages\"
    ImagePath = "\public\cms\Pages\Images\"

    FromEmail="info@next01.it"
    strPortalTitle="CMS"
    Show_Title_Above_Content = "1" '1 = yes, 0 = no
    CMS_Title_Color = "White" 'only if Show_Title_Above_Content = 1 (yes)
    CMS_Title_Font = "Arial" 'only if Show_Title_Above_Content = 1 (yes)
    CMS_Background_Color = "Steelblue"
    %>
    fine codice-------------------------


    L'errore che viene restituito dice che non funziona qualcosa sulla pagina /cms/pages/includes/database.asp, di cui riporto il codice:

    inizio codice-------------------------
    <%
    function killChars(strWords)

    dim badChars
    dim newChars ,i

    badChars = array("select", "drop", ";", "--", "insert", "delete", "xp_")
    newChars = strWords

    for i = 0 to uBound(badChars)
    newChars = replace(newChars, badChars(i), "")
    next

    killChars = newChars

    end function
    function SQLSafeString(pstrString)
    SQLSafeString=replace(pstrString,"'","''")
    end function

    function QuerySafeString(pstrString)
    QuerySafeString=replace(pstrString,"'","''")
    QuerySafeString=killChars(QuerySafeString)
    end function

    Class clsDatabase
    Public GetConnectionString

    'Private Sub Class_Initialize
    ' End Sub

    ' Private Sub Class_Terminate
    ' End Sub

    Public Function Execute(strSQL,strErrorMessages)

    Dim oRS
    'on error resume next
    strErrorMessages=""
    Set oRS = Server.CreateObject("ADODB.Recordset")
    oRS.CursorLocation = 3
    'Response.Write strSQL
    oRS.Open strSQL, CStr(GetConnectionString) ,3,3
    if err.number <> 0 then
    strErrorMessages = strErrorMessages & " Error occured. " & err.description & ""
    err.clear
    end if
    oRS.ActiveConnection = Nothing
    Set Execute = oRS
    Set oRS = Nothing

    End Function


    Public sub ExecuteDML(strSQL,strErrorMessages)

    Dim con
    'on error resume next
    Set con = Server.CreateObject("ADODB.Connection")
    Con.Mode = 3
    con.Open CStr(GetConnectionString) ,"Admin",""

    if err.number <> 0 then
    strErrorMessages=strErrorMessages & " Error occured. " & err.description & ""
    err.clear
    end if
    con.Execute (strSQL)
    if err.number <> 0 then
    strErrorMessages = strErrorMessages & " Error occured. " & err.description & ""
    err.clear
    end if

    End sub

    End Class

    function TableBodyList(byval pstrSQL,pstrHeaderRowParameters, _
    pstrHeaderColumnParameters,pstrDataRowParameters, _
    pstrDataColumnParameters,byref pconClass)

    dim strTemp,rst,i,intFieldCount',conClass
    'set conClass =new ClsDataBase
    'conClass.getconnectionstring = PortalConnectString
    'set rst= conClass.Execute (pstrSQL)
    'esponse.Write pstrSQL
    'esponse.End
    set rst= pconClass.Execute(pstrSQL,strTemp)

    if strTemp<>"" then
    strTemp="<TR " & pstrDataRowParameters & "><TD " & pstrDataColumnParameters & ">" & strTemp & "</TD></TR>"

    TableBodyList = strTemp

    exit function
    else

    strTemp="<TR " & pstrHeaderRowParameters & ">"
    intFieldCount=rst.fields.count-1
    for i = 0 to intFieldCount
    strTemp= strTemp & "<TH " & pstrHeaderColumnParameters & ">" & Replace(rst.fields(i).name,"'","") & "</TH>"
    next
    strTemp= strTemp & "<TH " & pstrHeaderColumnParameters & ">Delete</TH>"
    strTemp= strTemp & "</TR>"
    while NOT rst.eof
    strTemp= strTemp & "<TR " & pstrDataRowParameters & ">"

    strTemp= strTemp & "<TD " & pstrDataColumnParameters & "><A HREF =""javaScript:ModifyData('" & rst(0).value & "')"" >" & _
    rst(0).value & "</A></TD>"
    for i = 1 to intFieldCount
    strTemp= strTemp & "<TD " & pstrDataColumnParameters & ">" & rst(i).value & "</TD>"
    NEXT
    strTemp= strTemp & "<TD " & pstrDataColumnParameters & "><A HREF =""javaScripteleteData('" & rst(0).value & "')"">Delete</TD>"

    strTemp= strTemp & "</TR>"
    rst.movenext
    wend
    end if
    TableBodyList = strTemp
    set rst = nothing
    exit function

    end function

    function ComboBoxOptionList(byval pstrSQL,pstrSelectedValue, _
    byref pconClass)
    dim strTemp,rst,strTempResults
    set rst= pconclass.Execute (strsql,strTempResults)
    strTemp = ""
    if strTempResults ="" then

    while not rst.eof
    strTemp=rst(0).value
    IF pstrSelectedValue=strTemp then
    strTempResults = strTempResults & "<OPTION SELECTED VALUE='" & strTemp & "'>" & rst(1).value & "</OPTION>"
    else
    strTempResults = strTempResults & "<OPTION VALUE='" & strTemp & "'>" & rst(1).value & "</OPTION>"
    end if

    rst.movenext
    wend
    else
    strTempResults = "<OPTION VALUE=''>" & strTempResults & "</OPTION>"
    end if
    ComboBoxOptionList = strTempResults

    set rst = nothing
    exit function

    end function


    function TableMenuList(byval pstrSQL,pstrHeaderRowParameters, _
    pstrHeaderColumnParameters,pstrDataRowParameters, _
    pstrDataColumnParameters,byref pconClass)

    dim strTemp,rst
    set rst= pconClass.Execute(pstrSQL,strTemp)

    if strTemp<>"" then
    strTemp="<TR " & pstrDataRowParameters & "><TD " & pstrDataColumnParameters & ">" & strTemp & "</TD></TR>"

    TableMenuList = strTemp

    exit function
    else

    while NOT rst.eof
    strTemp= strTemp & "<TR " & pstrDataRowParameters & ">"

    strTemp= strTemp & "<TD " & pstrDataColumnParameters & "><A target =""Pages"" HREF =""" & rst(1).value & """ >" & _
    rst(0).value & "</A></TD>"
    strTemp= strTemp & "</TR>"
    rst.movenext
    wend
    end if
    TableMenuList = strTemp
    set rst = nothing
    exit function

    end function

    %>
    fine codice-------------------------


    Potete aiutarmi? Grazie

  2. #2
    codice:
    PortalConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mapPath("\mdb-database\CMSDB.mdb") & ";Persist Security Info=False"
    il resto del codice non l'ho letto...è troppo lungo e poi in gialletto non si legge una mazza

  3. #3
    ti incollo solo il pezzo in cui mi dice che ce errore

    ----------
    Public Function Execute(strSQL,strErrorMessages)

    Dim oRS
    'on error resume next
    strErrorMessages=""
    Set oRS = Server.CreateObject("ADODB.Recordset")
    oRS.CursorLocation = 3
    'Response.Write strSQL
    oRS.Open strSQL, CStr(GetConnectionString) ,3,3
    if err.number <> 0 then
    strErrorMessages = strErrorMessages & " Error occured. " & err.description & ""
    err.clear
    end if
    oRS.ActiveConnection = Nothing
    Set Execute = oRS
    Set oRS = Nothing

    End Function
    -------------

  4. #4
    cambia come ti ho detto la portalconnection che quell'altra era sbagliata....gira nel codice vedendo se ce ne è un altra di connection strings, e se hai dubbi leggiti www.connectionstrings.com

  5. #5
    Non ci capisco nulla di connesisoni a database. sto tentando di usare una di quelle applicazioni gia pronte, ma non riesco a risolvere il problema, continua a darmi errore anche modificando come mi hai detto

  6. #6
    ORA funziona!, almeno la pagina iniziale! GRAZIE

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.