Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560

    Errore: Expected end of statement

    ciao

    Microsoft VBScript compilation error '800a0401'

    Expected end of statement

    /include/connDb_comuni_imm.asp, line 9

    var oValori = new Object();

    codice:
    <% 
    'APERTURA CONNESSIONE CON IL DATABASE SENZA DSN
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/mdb-database/Comuni-imm.mdb")
    
    var oValori = new Object();
    
    var strCodiceFiscale = new String(Request("cod_fisc"));
    if ( strCodiceFiscale.valueOf() == "undefined" )
        strCodiceFiscale = "";
        
    var strCognome = new String(Request("cognome"));
    if ( strCognome.valueOf() == "undefined" )
        strCognome = "";
    
    var strNome = new String(Request("mnome"));
    if ( strNome.valueOf() == "undefined" )
        strNome = "";
        
    var strGiorno = new String(Request("giorno"));
    if ( strGiorno.valueOf() == "undefined" )
        strGiorno = "";
    var strMese = new String(Request("mese"));
    if ( strMese.valueOf() == "undefined" )
        strMese = "";
    var strAnno = new String(Request("anno"));
    if ( strAnno.valueOf() == "undefined" )
        strAnno = "";
        
    var strSesso = new String(Request("sesso"));
    if ( strSesso.valueOf() == "undefined" )
        strSesso = "F";
    
    var strIdProvincia = new String(Request("id_provincia"));
    if ( strIdProvincia.valueOf() == "undefined" )
        strIdProvincia = "-";
    
    var strIsComune = new String(Request("is_comune"));
    var bIsComune = true;
    
    var strIdComune = new String(Request("id_comune"));
    if ( strIdComune.valueOf() == "undefined" )
        strIdComune = "-";
    
    if ( strIsComune.valueOf() == "undefined" )
        strIsComune = "SI";
    if ( strIsComune.valueOf() == "SI" )
        bIsComune = true;
    else
        bIsComune = false;
    
    
    
    oValori.strCognome = new String(strCognome);
    oValori.strNome = new String(strNome);
    oValori.strGiorno = new String(strGiorno);
    oValori.strMese = new String(strMese);
    oValori.strAnno = new String(strAnno);
    oValori.strSesso = new String(strSesso);
    oValori.strIdProvincia = new String(strIdProvincia);
    oValori.is_comune = new String(strIsComune);
    oValori.bIsComune = bIsComune;
    oValori.strIdComune = new String(strIdComune);
    
    function RiempiComboGiorno(oVal)
    {
        var strK = new String();
        var k;
        for ( k = 1; k < 32; k++  )
        {
            strK = "";
            if ( k <= 9 )
                strK = "0";
            strK += "" + k;
            if ( oVal.strGiorno.valueOf() == strK.valueOf() )
            {
                Response.Write("<option selected value='" + strK + "'>" + strK + "</option>");
            }
            else
            {
                Response.Write("<option value='" + strK + "'>" + strK + "</option>");
            }
        }
    }
    
    function RiempiComboMese(oVal)
    {
        var strK = new String();
        var k;
        for ( k = 1; k < 13; k++  )
        {
            strK = "";
            if ( k <= 9 )
                strK = "0";
            strK += "" + k;
            if ( oVal.strMese.valueOf() == strK.valueOf() )
            {
                Response.Write("<option selected value='" + strK + "'>" + strK + "</option>");
            }
            else
            {
                Response.Write("<option value='" + strK + "'>" + strK + "</option>");
            }
        }
    }
    
    function RiempiComboAnno(oVal)
    {
        var strK = new String();
        var k;
        for ( k = 1890; k < 2051; k++  )
        {
            strK = "";
            strK += "" + k;
            if ( oVal.strAnno.valueOf() == strK.valueOf() )
            {
                Response.Write("<option selected value='" + strK + "'>" + strK + "</option>");
            }
            else
            {
                Response.Write("<option value='" + strK + "'>" + strK + "</option>");
            }
        }
    }
    
    function RiempiComboSesso(oVal)
    {
        if ( oVal.strSesso.valueOf() == "F" )
        {
            Response.Write("<option selected value='F'>F</option>");
            Response.Write("<option value='M'>M</option>");
        }
        else
        {
            Response.Write("<option value='F'>F</option>");
            Response.Write("<option selected value='M'>M</option>");
        }
    }
    
    function RiempiComboComuneStato(oVal)
    {
        if ( oVal.bIsComune )
        {
            Response.Write("<option selected value='SI'>Comune Italiano</option>");
            Response.Write("<option value='NO'>Stato estero</option>");
        }
        else
        {
            Response.Write("<option value='SI'>Comune Italiano</option>");
            Response.Write("<option selected value='NO'>Stato estero</option>");
        }
    }
    
    function RiempiComboProvincia(oVal, strConn)
    {
        if ( !oVal.bIsComune )
            return;
            
        var oConn;	
        var oRs;
        var strSQL;
    	    
        //var strComune;
        //var re;
        //re = /'/g;
        //strComune = Nome.replace(re, "''")
    			
        oConn = Server.CreateObject("ADODB.Connection");
        oRs = Server.CreateObject("ADODB.Recordset");
        
        oConn.Open(strConn);
    
        strSQL = "SELECT ID, CAPOLUOGO FROM PROVINCE ORDER BY CAPOLUOGO"
        
        oRs.ActiveConnection = oConn;            
        oRs.CursorLocation = 3; // adUseClient
        oRs.CursorType = 0; // adOpenForwardOnly
        oRs.LockType = 1; // adLockReadOnly 
        oRs.Source = strSQL;
        oRs.Open();
        
        var strID = new String();
        
        while ( !oRs.EOF )
        {
            strID = "" + oRs("ID");
            
            if ( oVal.strIdProvincia == strID )
            {
                Response.Write("<option selected value='" + oRs("ID") + "' >" + oRs("CAPOLUOGO") + "</option>");
            }
            else
            {
                Response.Write("<option value='" + oRs("ID") + "'>" + oRs("CAPOLUOGO") + "</option>");
            }
            oRs.MoveNext();
        }
        
        if ( oRs.State == 1 )
            oRs.Close();
        if ( oConn.State == 1 )
            oConn.Close();
    }
    
    function RiempiComboComuni(oVal, strConn)
    {
        var oConn;	
        var oRs;
        var strSQL;
    
        var str = new String(oVal.strIdProvincia);
        if ( (oVal.bIsComune) && ((str.valueOf() == "-") || (str.valueOf() == "undefined") || (str.valueOf() == "")) )
            return;
       
        //var strComune;
        //var re;
        //re = /'/g;
        //strComune = Nome.replace(re, "''")
    			
        oConn = Server.CreateObject("ADODB.Connection");
        oRs = Server.CreateObject("ADODB.Recordset");
        
        oConn.Open(strConn);
    
        if ( oVal.bIsComune == true )
        {
            strSQL = "SELECT ID, COMUNE AS NOME FROM ITALIA WHERE ID_PROVINCIA = " + oVal.strIdProvincia + " AND CODICE_FISCALE IS NOT NULL ORDER BY COMUNE ";
        }
        else
        {
            strSQL = "SELECT ID, DENOMINAZIONE AS NOME FROM ESTERI WHERE CODICE IS NOT NULL ORDER BY DENOMINAZIONE ";
        }
    
        //Response.Write("<script>alert('" + strSQL + "');</script>");
       
        oRs.ActiveConnection = oConn;            
        oRs.CursorLocation = 3; // adUseClient
        oRs.CursorType = 0; // adOpenForwardOnly
        oRs.LockType = 1; // adLockReadOnly 
        oRs.Source = strSQL;
        oRs.Open();
        
        var strID = new String();
        
        while ( !oRs.EOF )
        {
            strID = "" + oRs("ID");
            
            if ( oVal.strIdComune.valueOf() == strID.valueOf() )
            {
                Response.Write("<option selected value='" + oRs("NOME") + "' >" + oRs("NOME") + "</option>");
            }
            else
            {
                Response.Write("<option value='" + oRs("NOME") + "'>" + oRs("NOME") + "</option>");
            }
            oRs.MoveNext();
        }
        
        if ( oRs.State == 1 )
            oRs.Close();
        if ( oConn.State == 1 )
            oConn.Close();
    }
    %>

  2. #2
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    mi da anche questo errore, se metto il codice nella pagina del form:

    Microsoft VBScript compilation error '800a0401'

    Expected end of statement

    /Default.asp, line 5

    var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("/mdb-database/Comuni-imm.mdb") + ";";

    forse ci manca questo ad inizio pagina: <%@ Language=JScript %>

    ma se lo metto mi genera questo errore:

    Microsoft JScript compilation error '800a03ec'

    Expected ';'

    include/inc_db_imm.asp, line 3

    Dim Conn


    forse perchè vbS e js non si possono eseguire insieme?

    come posso risolvere?

    thx

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.