Visualizzazione dei risultati da 1 a 6 su 6

Discussione: errore nel codice

  1. #1

    errore nel codice

    ciao a tutti, qualcuno riesce a trovare un errore in questo codice? sicuramente c'è perchè mi da una pagina di errore, la classica schermata "Impossibile visualizzare la pagina"

    grazie mille

    <%@LANGUAGE = VBScript%>

    <%
    If Session("admin") <> "OK" Then Response.Redirect "index.asp"
    Dim cn, rs
    Set cn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.Recordset")
    cn.Open sc
    %>
    <html>
    <head>
    <title><%=titolo%></title>
    <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    <body>

    <h1 align="center"><%=titolo%></h1>

    <form method="post" action="insert.asp">
    <table align="center" width="50%" border="1">
    <tr>
    <td width="40%">Data</td>
    <td width="60%"><input type="text" name="giorno" maxlength="50" style="width: 100%;"></td>
    </tr>
    <tr>
    <td>Città</td>
    <td><input type="text" name="citta" maxlength="10000" style="width: 100%;"></td>
    </tr>
    <tr>
    <td>Venue</td>
    <td><input type="text" name="venue" maxlength="10000" style="width: 100%;"></td>
    </tr>
    <tr>
    <td>Guests</td>
    <td><input type="text" name="guests" maxlength="10000" style="width: 100%;"></td>
    </tr>
    <tr>
    <td colspan="2" align="right">
    <input type="submit" name="insert" value=" Nuovo ">
    </td>
    </tr>
    </table>
    </form>

    <%
    If Request.Form("insert") = " Nuovo " Then
    Dim giorno, citta, venue, guests
    giorno = Request.Form("giorno")
    citta = Request.Form("citta")
    venue = Request.Form("venue")
    guests = Request.Form("guests")
    If Len(Trim(giorno)) = 0 Or Len(Trim(citta)) = 0 Or Len(Trim(venue)) = 0
    Then
    Response.Write "<p align=""center"">Tutti i campi sono obbligatori</p>"
    Else
    rs.Open "gigs", cn, 3, 3
    rs.AddNew
    rs("giorno") = giorno
    rs("citta") = citta
    rs("venue") = venue
    rs("guests") = guests
    rs.Update
    rs.Close
    Response.Write "<p align=""center"">Inserimento effettuato con successo</p>"
    End If
    End If
    %>

    <p align="center">LEGGI I DATI | LOGOUT</p>






    <p align="center" style="font: Normal 10px Verdana;">
    </p>

    </body>
    </html>
    <%
    Set rs = Nothing
    cn.Close
    Set cn = Nothing
    %>

  2. #2
    magari se togli la spunta a "mostra errori http brevi" nelle opzioni di explorer il tizio ti dice sia l'errore che la riga

  3. #3
    ok, l'errore che mi da è questo:

    Microsoft VBScript compilation error '800a03f9'

    Expected 'Then'

    /prova/gigs/insert.asp, line 52

    If Len(Trim(giorno)) = 0 Or Len(Trim(citta)) = 0 Or Len(Trim(venue)) = 0

    ma cosa c'è li di sbagliato secondo te?

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Il THEN va sulla stessa riga dell'IF

    Roby

  5. #5
    se ti dice che si aspetta un then e tu then non l'hai scritto, quale sarà mai il motivo?

  6. #6
    ahah è vero... però bo, il then era sotto e pensavo andasse bene lo stesso..
    che ddire, errori da principiante

    grazie sul serio ragazzi..sarei stato li delle ore senza di voi e forse non avrei trovato lo stesso una soluzione

    ciao ciao

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.