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

    Problema update con campo double

    Salve, ho questo tipo di problema (db MySql)
    Il campo prezzoclick è un DOUBLE e anche il campo spesa è DOUBLE.
    Se in prezzoclick ho un valore intero (es 5) nessun problema ma se ho (4.5 mi da errore)
    l'update che faccio è il seguente:

    clickattuale2 = (hit.Fields.Item("prezzoclick").Value)

    set updateclick2 = Server.CreateObject("ADODB.Command")
    updateclick2.ActiveConnection = MM_datacat20_STRING
    updateclick2.CommandText = "UPDATE n_banner SET spesa = spesa + "&clickattuale2&" WHERE ID = "&idbanner&""
    updateclick2.CommandType = 1
    updateclick2.CommandTimeout = 0
    updateclick2.Prepared = true
    updateclick2.Execute()


  2. #2
    nik, ancora convinto che basti dire "mi da errore" e noi si capisce che errore ti dà e come lo si risolve?

  3. #3
    ecco l'errore:

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

    [MySQL][ODBC 3.51 Driver][mysqld-5.0.45-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '5 WHERE ID = 5' at line 1

  4. #4
    quindi, il comando è sbagliato.

    ma cosa abbiamo scritto dentro la definizione del comando?

    ----------------------------------------------------
    impariamo a fare un po' di debug

    codice:
    Dim sql
    sql = "UPDATE n_banner SET spesa = spesa + " & clickattuale2 & " WHERE ID = " & idbanner & ""
    Response.Write "maGGica SQL...: " & sql & "
    "
    Response.Flush
    updateclick2.CommandText = sql
    poi posta quello che viene a video
    ----------------------------------------------------

  5. #5
    Grazie. Ho capito dove sbagliavo. Ho messo un replace ed ora è ok:

    clickattuale2 = Replace(hit.Fields.Item("prezzoclick").Value,","," .")

  6. #6

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 © 2026 vBulletin Solutions, Inc. All rights reserved.