7 messaggi dal 07 dicembre 2014
salve, mi correggete questo codice, mi da il seguente errore: Syntax error in UPDATE statement

Ecco il codice:

<!--#include file="upload.asp"-->
<%
Dim oUpload
Set oUpload = new cUpload
oUpload.AutoRename = False
oUpload.Overwrite = true
oUpload.SetPath "../public/"
oUpload.Upload
'oUpload.Save
idabbo = oUpload.Form("textfield10")
abbonamento = oUpload.Form("abbonamento")
prezzo = oUpload.Form("prezzo")
quantita = oUpload.Form("quantita")
nomefile =oUpload.Form("foto")
'descrizione =oUpload.Form("descrizione")
' Dimensione = oUpload.Files("Size")
' Dimensione = cInt(Dimensione)*0.001
nomefile = right(nomefile, len(nomefile) - instrrev(nomefile, "\"))
newname = nomefile 'tabella&"-"&id&"-"&nomefile
oUpload.SaveAs newname
Set oUpload=Nothing
On Error Resume Next
if "["&newname&"]" <> "[]" then
pezzoquery = ", fotox = '"&newname&"'"
else
pezzoquery = ""
end if

if "["&Trim(abbonamento)&"]" <> "[]" then
else
%>
<script>
alert("Per favore, compila correttamente tutti i campi!");
window.history.back();
</script>
<%
response.end
end if

if "["&Trim(prezzo)&"]" <> "[]" then
else
%>
<script>
alert("Per favore, compila correttamente tutti i campi!");
window.history.back();
</script>
<%
response.end
end if

if "["&Trim(quantita)&"]" <> "[]" then
else
%>
<script>
alert("Per favore, compila correttamente tutti i campi!");
window.history.back();
</script>
<%
response.end
end if

'if "["&Trim(newname)&"]" <> "[]" then
' else
' % >
' <script>
' alert("Per favore, compila correttamente tutti i campi!");
' window.history.back();
' </script >
' <%
' response.end
'end if

On Error Resume Next
sql = "update into abbonamenti (titolo, prezzo, quantita) values ("&abbonamento&","&prezzo&","&quantita&")"
Set Conn = Server.CreateObject( "ADODB.Connection" )
StrConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../mdb-database/fidelitycard.mdb")&";Persist Security Info=False"
Conn.open = StrConnect

conn.execute(sql)

If Err.Number <> 0 then
Response.Write Err.description & "<br>" & sql : Response.end
Else%>
<script>
alert("Complimenti! L\'abbonamento e\' stato inserito con successo!");
window.location = "../admin/elenco_abbonamento.asp";
</script>
<%
End if

%>
175 messaggi dal 02 gennaio 2012
Hi,

l'istruzione sql

sql = "update into abbonamenti (titolo, prezzo, quantita) values ("&abbonamento&","&prezzo&","&quantita&")"


se vuoi inserire un nuovo record diventa

sql = "insert into abbonamenti (titolo, prezzo, quantita) values ("&abbonamento&","&prezzo&","&quantita&")"

se vuoi modificare un nuovo record diventa

sql = "update abbonamenti SET titolo= ....where .....

BYE GHG

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.