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

    Errore sql potete aiutarmi per piacere?

    Ciao a tutti,

    ho il seguente codice per inserire 4 campi in una tabella:
    ----------------------

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

    <%

    if(Request.Querystring("cognome") <> "") then Command1__var1 = Request.Querystring("cognome")

    if(Request.Querystring("nome") <> "") then Command1__var2 = Request.Querystring("nome")

    if(Request.Querystring("pws") <> "") then Command1__var4 = Request.Querystring("pws")

    if(Request.Querystring("user") <> "") then Command1__mm = Request.Querystring("user")

    %>
    <%

    set Command1 = Server.CreateObject("ADODB.Command")
    Command1.ActiveConnection = MM_conn_strl_STRING
    Command1.CommandText = "INSERT INTO amministratori (cognome, nome, pws, user) VALUES ('" + Replace(Command1__var1, "'", "''") + "', '" + Replace(Command1__var2, "'", "''") + "', '" + Replace(Command1__var4, "'", "''") + "', '" + Replace(Command1__mm, "'", "''") + "') "
    Command1.CommandType = 1
    Command1.CommandTimeout = 0
    Command1.Prepared = true
    Command1.Execute()

    %>
    <html>
    <head>
    <title>Documento senza titolo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="refresh" content="0;URL=pannello_controllo.asp">
    </head>

    <body>
    </body>
    </html>

    -------------------------------------

    Che mi genera questo errore:

    -------------------------------------

    Please try the following:

    Fare clic sul pulsante Aggiorna o riprovare più tardi.

    Aprire la localhost home page e cercare i collegamenti alle informazioni desiderate.
    HTTP 500.100 - Errore interno del server - errore ASP
    Internet Information Services

    --------------------------------------------------------------------------------

    Informazioni tecniche (per il personale del supporto tecnico)

    Tipo di errore:
    Microsoft JET Database Engine (0x80040E14)
    Errore di sintassi nell'istruzione INSERT INTO.
    /successo-travel/amministrazione/insert_amministratori.asp, line 22


    Tipo di browser:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)

    Pagina:
    GET /successo-travel/amministrazione/insert_amministratori.asp

    Ora:
    lunedì 7 giugno 2004, 20.03.43


    Informazioni aggiuntive:
    Supporto Microsoft

    ---------------------------------

    Sapreste dirmi perchè? Ho ricontrollato più volte ma non mi sebra di aver commesso errori.....

    Grazie

  2. #2
    commenta questa riga Command1.Execute()
    e stampa a video l'istruzione sql e vedi se ci sono errori

  3. #3
    come sarebbe stampa a video?

  4. #4
    Nessuno sa dirmi se ho commesso degli errori?

  5. #5
    Ultimo tentativo per farmi aiutare.

    Grazie lo stesso!

  6. #6

    Re: Errore sql potete aiutarmi per piacere?

    Invece di questo:

    <%

    set Command1 = Server.CreateObject("ADODB.Command")
    Command1.ActiveConnection = MM_conn_strl_STRING
    Command1.CommandText = "INSERT INTO amministratori (cognome, nome, pws, user) VALUES ('" + Replace(Command1__var1, "'", "''") + "', '" + Replace(Command1__var2, "'", "''") + "', '" + Replace(Command1__var4, "'", "''") + "', '" + Replace(Command1__mm, "'", "''") + "') "
    Command1.CommandType = 1
    Command1.CommandTimeout = 0
    Command1.Prepared = true
    Command1.Execute()

    %>


    scrivi solo:

    <%
    Response.write("INSERT INTO amministratori (cognome, nome, pws, user) VALUES ('" + Replace(Command1__var1, "'", "''") + "', '" + Replace(Command1__var2, "'", "''") + "', '" + Replace(Command1__var4, "'", "''") + "', '" + Replace(Command1__mm, "'", "''") + "') ")
    %>

    In questo modo, invece di eseguirla, stampi a video la stringa sql per poterla controllare. Postala. Ciao.

  7. #7
    INSERT INTO amministratori (cognome, nome, pws, user) VALUES ('qqqqq', 'qqqqq', 'qqq', '')

    non capisco perchè non mi porta l'ultima variabile

    ID-entity hai qualche dritta a riguardo?

  8. #8
    evidentemente Request.Querystring("user") è vuota

  9. #9
    Untitled-1.asp?cognome=wewewewew&nome=wewewee&pws=wewewe&us er=1972

    no è questo il fatto.

    inoltre se uso una connessione al db di tipo dsn funziona con un oledb no

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.