.dsy:it.
Show 150 posts per page

.dsy:it. (http://www.dsy.it/forum/)
- Forum De Bell Tolls (http://www.dsy.it/forum/forumdisplay.php?forumid=7)
-- Sql (http://www.dsy.it/forum/showthread.php?threadid=6527)


Posted by dan on 28-10-2003 09:36:

Sql

Come faccio ad inserire una data nulla?

Se faccio:


if(Request("giorno_inizio")="" OR Request("mese_inizio")="" OR Request("anno_inizio")="") then
rs("data_inizio") = ""
else
rs("data_inizio") = Request("giorno_inizio") & "/" & Request("mese_inizio") & "/" & Request("anno_inizio")
end if



Se non inserisco niente come giorno, mese, anno di inizio mi da un errore di tipo!
Come si può fare ad inserire una data nulla?

Grazie, D.


Posted by loreste on 28-10-2003 10:11:

Innanzi tutto bisogna vedere la struttura della tabella se hai permesso il valore null nel campo, qualora tu non l'avessi potrebbe essere la causa del tuo problema, in questo caso dovrai modificare tale struttura.

Ciao

__________________
La Fede non retrocede mai!
Döma Atalanta!!!!!!!!


Posted by dan on 28-10-2003 10:27:

Con un campo di tipo data non è possibile consentire il valore nullo.

Ho scritto quanto segue:


if not(Request("giorno_inizio")="" OR Request("mese_inizio")="" OR Request("anno_inizio")="") then
dinizio = Request("giorno_inizio") & "/" & Request("mese_inizio") & "/" & Request("anno_inizio")
end if

if not(Request("giorno_fine")="" OR Request("mese_fine")="" OR Request("anno_fine")="") then
dfine = Request("giorno_fine") & "/" & Request("mese_fine") & "/" & Request("anno_fine")
end if


SQLQuery = "UPDATE eventi_ecm SET cod_azienda = '" & qv1 & "' , titolo = '" & qv2 & "' , luogo = '" & qv3 & "' , location = '" & qv4 & "' , regione = '" & qv5 & "' , citta = '" & qv6 & "' , provincia = '" & qv7 & "' , tel = '" & qv9 & "' , fax = '" & qv10 & "' , data_inizio = '" & dinizio & "' , data_fine = '" & dfine & "' WHERE azienda = '" & Request("azienda") & "' AND titolo = '" & Request("old_titolo") & "' "

Conn.Execute(SQLQuery)



Ma mi dice:


Data type mismatch in criteria expression.
/ecm/modifica.asp, line 125


line 25: linea corrispondente a Conn.Execute


Posted by Gusher on 28-10-2003 17:48:

fai un controllo di questo tipo:

strQuery = "UPDATE Table SET Data="

if(strData="") then
strQuery = strQuery & "NULL "
else
strQuery = strQuery & "'strDataCorretta' "
end if

strQuery = strQuery & " WHERE ID=" & ID


All times are GMT. The time now is 06:15.
Show all 4 posts from this thread on one page

Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.