Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2004
    Messaggi
    272

    Problema di connessione al db

    Buon giorno a tutti,
    mi auguro che qualcuno possa aiutarmi...sto costruendo un sito che vende prodotti tipici, ho usato un pacchetto già fatto comprato da un sito americano (odio le cose fatte da programmatori esperti perchè è difficile capire dove mettere le mani!), in locale funziona tutto correttamente, ma quando pubblico tutto in rete, non si vede niente.
    Il problema deve essere in una pagina, quella principale che fa funzionare tutto il sito: Application.asp.
    In particolare credo che l'errore potrebbe essere questo:
    C'è una variabile Const datasource = "DSN=conncartweaver;User ID=;Password=;" che richiama una pagina conncartweaver.asp dove per la connessione ovviamente viene usato il metodo MapPath...
    però sul web non funziona.


    Il codice di Application.asp:
    <%

    Const datasource = "DSN=conncartweaver;User ID=;Password=;"
    Const dbType = "Access"
    Dim websiteURL : websiteURL = "http://server/cosvical/"
    Dim websiteSSLURL : websiteSSLURL = "https://server/cosvical/"
    Dim onSubmitAction : onSubmitAction = "Confirm"
    Dim targetResults : targetResults = "Results.asp"
    Dim recordsAtATime : recordsAtATime = "10"
    Dim targetDetails : targetDetails = "Details.asp"
    Dim detailsDisplay : detailsDisplay = "Advanced"
    Dim targetGoToCart : targetGoToCart = "ShowCart.asp"
    Dim targetCheckout : targetCheckout = "OrderForm.asp"
    Dim targetConfirmOrder : targetConfirmOrder = "Confirmation.asp"
    Dim ImageThumbFolder : ImageThumbFolder = "cw2/Assets/product_thumb/images/"
    Dim ImageLargeFolder : ImageLargeFolder = "cw2/Assets/product_full/images/"
    Const cwLocale = "1033"
    Const uploadCom = ""
    Const mailObj = "AspEmail"
    Const mailServer = "mail.arpanet.it"
    Dim paymentAuthType : paymentAuthType = "none"
    Dim paymentAuthName : paymentAuthName = "none"
    Dim enableErrorHandling : enableErrorHandling = True 'False for testing, True for live sites
    Dim cwDebug : cwDebug = False 'True for testing, False for live sites
    %>


    Il codice della pagina conncartweaver.asp è il seguente:
    <%
    Dim MM_conncartweaver_STRING
    Set MM_conncartweaver_STRING = Server.CreateObject("ADODB.Connection")
    MM_conncartweaver_STRING.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("db/cw2.mdb")
    %>

    Mi rivolgo soprattutto ai programmatori più esperti:
    DATEMI UNA MANO!!

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    1) Che errore hai (descrizione)?
    2) La variabile non richiama nulla... è una costante in quel caso, un DNS, che di sicuro online non puoi usare ed infatti ti connetti con MapPath(...).

    Roby

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2004
    Messaggi
    272
    Non si visualizza niente, dice Errore interno del server.
    Infatti ho capito che il problema è datasource che con DSN in rete non funziona, ma cosa dovrei scrivere per richiamare la pagina di connessione dove c'è il MapPath?

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Menu strumenti --> Opzioni internet --> Avanzate di Internet Explorer e disabilita la voce "Mostra messaggi di errore HTTP brevi".
    Ora guarda l'errore!

    Roby

  5. #5
    Utente di HTML.it
    Registrato dal
    Oct 2004
    Messaggi
    272
    Allora l'errore è il seguente:

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][Driver Manager ODBC] Nome origine dati non trovato e driver predefinito non specificato.

    /cw2/CWLibrary/CWIncFunctions.asp, line 134

    E la riga 134 di questa pag. è:

    Set cwOpenQuery = Server.CreateObject("ADODB.Recordset")
    With cwOpenQuery
    .ActiveConnection = strConn
    .Source = strSQL
    .CursorType = 3
    .CursorLocation = 2
    .LockType = 1
    .Open()
    End With
    End Function 'cwOpenQuery

    Function cwExecuteQuery(strSQL, strConn, strReturnID)

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    La "strConn" non è indicata nel primo script che hai postato.
    Verifica dove e come viene valorizzata.

    Roby

  7. #7
    Utente di HTML.it
    Registrato dal
    Oct 2004
    Messaggi
    272
    Questi sono i commenti che parlano della connessione:


    'strConn: The strConn argument contains the connection string to be used
    ' to connect to your database. By default, Cartweaver uses the datasource
    ' variable, which is defined in CWIncGlobalSettings, and uses the
    ' connection string in the Connections folder.

    'RETURNS
    'A recordset object based on the supplied SQL statement.

    'EXAMPLES
    'Return a query from the default Cartweaver datasource.
    'Set rsMyRecordset = CWOpenQuery("SELECT * FROM table", datasource)

    'Return a query from a custom datasource.
    'Set rsMyRecordset = CWOpenQuery("SELECT * FROM table", "DSN = MyDSN")

    Però nella pagina CWIncGlobalSettings.asp non viene valorizzata strconn:
    Dim rsGetCompInfo
    Set rsGetCompInfo = CWOpenQuery("SELECT * FROM tbl_companyinfo",datasource)

    Mamma mia non ci sto capendo niente!

  8. #8
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Questa è l'unica utlizzata:

    codice:
    Dim rsGetCompInfo 
    Set rsGetCompInfo = CWOpenQuery("SELECT * FROM tbl_companyinfo",datasource)

    perché le altre righe sono commentate.

    Questa dovrebbe funzionare se venisse richiamata da qualche parte:

    codice:
    MM_conncartweaver_STRING.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("db/cw2.mdb")
    Provala così, se il database è nella db e quest'utlima è una sottocartella della root di primo livello quindi:
    codice:
    MM_conncartweaver_STRING.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("/ db/cw2.mdb")
    Occhio allo slash aggiunto!

    Roby

  9. #9
    Utente di HTML.it
    Registrato dal
    Oct 2004
    Messaggi
    272
    Sei veramente molto gentile e disponibile...
    cmq ancora non ci sono...
    Ho provato a scrivere nella pag. Application.asp dove c'è la var datasource quella stringa (mentre prima era nella cartella Connections/conncartweaver.asp):
    Const datasource = MM_conncartweaver_STRING.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("/ db/cw2.mdb")

    Pensando che poteva funzionare, ma invece mi dà questo errore:

    Microsoft VBScript compilation error '800a0415'

    Expected literal constant

    /Application.asp, line 4

    Const datasource = MM_conncartweaver_STRING.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("/ db/cw2.mdb")
    -------------------------------------------------^

  10. #10
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Non so dirti altro... ho raschiato il fondo del barile...
    E' presumibilmente un problema di percorsi.
    Assicurati che il DNS non sia utilizzato.

    Roby

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.