Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 21
  1. #1

    query per aggiunta valore ad un capo

    Salve ragazzi ho questo tipo di query da realizzare...

    Vorrei che preso il valore da un campo del form mi si aggiunga ad uno presente nel batabase.
    esempio il campo voto è 5 mi dovrebbe aggiornare il campo voto con quello esistente piu 5.

    Una cosa tipo Update tabella set voto = voto + "valore preso dal campo form" where id etc etc
    http://www.generationweb.it <--- web site

  2. #2
    codice:
    voto = request.form("voto")
    id = reuqest.form("id")
    if len(voto) > 0 and isNumeric(voto) then
    sql = "UPDATE tabella1 SET campo = campo + " & voto & " WHERE ID = " & id
    conn.execute(sql)
    end if

  3. #3
    wow...provo
    http://www.generationweb.it <--- web site

  4. #4
    ciao ho fatto in questo modo e mi da questo errore

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID ='.

    /prova/voto_effettuato.asp, line 13

    il codice è questo
    codice:
    <% 
    voto = request.form("voto")
    id = request.form("id")
    if len(voto) > 0 and isNumeric(voto) then
    
    ' Mappaggio del database
    Set Conn=Server.CreateObject("ADODB.Connection")
    strConn="driver={Microsoft Access Driver (*.mdb)}; "
    strConn=strConn & " DBQ=" & Server.MapPath("/mdb-database/votazioni_siti.mdb")
    Conn.Open strConn
    
    sql = "UPDATE votazioni SET voto = voto + " & voto & " WHERE ID = " & id 
    conn.execute(sql)
    
    end if
    %>
    http://www.generationweb.it <--- web site

  5. #5
    L'id lo passi alla pagina per il record da aggiornare?

  6. #6
    la pagina precedente è la seguente

    codice:
    <%
    	id = request.querystring("id")
    	conf = request.querystring("conf")
    	if conf <> "si" then
    	Set conn = Server.CreateObject("ADODB.Connection")
    	sql = "SELECT * FROM siti_web WHERE id=" & id 
    	dsnpath = "DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)}; "
    	dsnpath = dsnpath & "DBQ=" & Server.MapPath("/mdb-database/votazioni_siti.mdb")
    	conn.open dsnpath
    	Set rs = Conn.Execute(sql)
    	Set titolo = rs("titolo")
    	Set autore = rs("autore")
    	Set url = rs("url")
    	
    %>
    http://www.generationweb.it <--- web site

  7. #7
    Si, ma poi alla pagina successiva come lo passi l'ID?
    Dovresti metterlo in un campo hidden.

  8. #8
    cioè l'id dovrei richiamarlo nel form?
    http://www.generationweb.it <--- web site

  9. #9
    Eccerto. Sennò come lo passi alla pagina successiva?

  10. #10
    eh si però io ho due tabelle una chiamata siti e un'altra votazioni...quindi l'id della tabella vitazioni è diverso da quello della tabella siti no?
    http://www.generationweb.it <--- web site

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.