Metalhunter
05-26-2003, 12:04 PM
Hey
I have a problem with datetime is out of range.
I doesn't update or insert into a field that's from the type date/time in my database. The field are all varchar (..)
This is a part of my code:
'declarations
dim sConnect, conMed, error
dim rsInsert, rsUpdateCom, rsUpdateGeb, rsLastResNr, rsFindNr, rsZoek
dim sqlInsert, sqlUpdateCom, sqlUpdateGeb, sqlLastResNr, sqlFindNr, sqlZoek
dim temp, tempDate, tempMin, startDate, tempStartDate, stamNr
dim lastResNr, computerId, tijd, startTime, stopTime, compNaam, last
temp = Request.Form("startDate")
tempDate = temp '((Day(temp) &"/"& Month(temp) &"/"& Year(temp)))
tempMin = Request.Form ("Tijd")
startDate = Request.Form("StartTime")
startDate = (Request.Form("StartTime"))
tempStartDate = (StartDate)
some code
computerId = Request.Form ("computerID")
tijd = Request.Form ("tijd")
startDate = (Request.Form ("startDate"))
startTime = (Request.Form ("StartTime"))
stopTime = (startTime + tijd)
stamNr = rsFindNr.Fields (0).Value
more code
'update computer
sqlUpdateCom = "update computer set "
sqlUpdateCom = sqlUpdateCom & " reservatie_nummer = CONVERT(int, '" &lastResNr & "')"
sqlUpdateCom = sqlUpdateCom & ", reservatie_stamnummer = " & "'" & stamNr & "'"
sqlUpdateCom = sqlUpdateCom & " where computer_nummer = CONVERT(integer, '" & computerID & "') "
set rsUpdateCom = conMed.Execute (sqlUpdateCom)
'!!!!! Here he gives me the error!!!!!!!
'update gebruiker
sqlUpdateGeb = "update gebruiker set"
sqlUpdateGeb = sqlUpdateGeb & " gebruiker_datum = CONVERT(varchar(30), '" &startDate & "')"
sqlUpdateGeb = sqlUpdateGeb & ", gebruiker_begintijd = CONVERT(varchar(30), '" &startTime & "')"
sqlUpdateGeb = sqlUpdateGeb & ", gebruiker_eindtijd = CONVERT(varchar(30), '" &stopTime & "')"
sqlUpdateGeb = sqlUpdateGeb & ", reservatie_nummer = CONVERT(int, '" &lastResNr & "')"
sqlUpdateGeb = sqlUpdateGeb & " where gebruiker_stamnummer = CONVERT(varChar(8), '" & stamNr & "')"
set rsUpdateGeb = conMed.Execute (sqlUpdateGeb)
Thanks
I have a problem with datetime is out of range.
I doesn't update or insert into a field that's from the type date/time in my database. The field are all varchar (..)
This is a part of my code:
'declarations
dim sConnect, conMed, error
dim rsInsert, rsUpdateCom, rsUpdateGeb, rsLastResNr, rsFindNr, rsZoek
dim sqlInsert, sqlUpdateCom, sqlUpdateGeb, sqlLastResNr, sqlFindNr, sqlZoek
dim temp, tempDate, tempMin, startDate, tempStartDate, stamNr
dim lastResNr, computerId, tijd, startTime, stopTime, compNaam, last
temp = Request.Form("startDate")
tempDate = temp '((Day(temp) &"/"& Month(temp) &"/"& Year(temp)))
tempMin = Request.Form ("Tijd")
startDate = Request.Form("StartTime")
startDate = (Request.Form("StartTime"))
tempStartDate = (StartDate)
some code
computerId = Request.Form ("computerID")
tijd = Request.Form ("tijd")
startDate = (Request.Form ("startDate"))
startTime = (Request.Form ("StartTime"))
stopTime = (startTime + tijd)
stamNr = rsFindNr.Fields (0).Value
more code
'update computer
sqlUpdateCom = "update computer set "
sqlUpdateCom = sqlUpdateCom & " reservatie_nummer = CONVERT(int, '" &lastResNr & "')"
sqlUpdateCom = sqlUpdateCom & ", reservatie_stamnummer = " & "'" & stamNr & "'"
sqlUpdateCom = sqlUpdateCom & " where computer_nummer = CONVERT(integer, '" & computerID & "') "
set rsUpdateCom = conMed.Execute (sqlUpdateCom)
'!!!!! Here he gives me the error!!!!!!!
'update gebruiker
sqlUpdateGeb = "update gebruiker set"
sqlUpdateGeb = sqlUpdateGeb & " gebruiker_datum = CONVERT(varchar(30), '" &startDate & "')"
sqlUpdateGeb = sqlUpdateGeb & ", gebruiker_begintijd = CONVERT(varchar(30), '" &startTime & "')"
sqlUpdateGeb = sqlUpdateGeb & ", gebruiker_eindtijd = CONVERT(varchar(30), '" &stopTime & "')"
sqlUpdateGeb = sqlUpdateGeb & ", reservatie_nummer = CONVERT(int, '" &lastResNr & "')"
sqlUpdateGeb = sqlUpdateGeb & " where gebruiker_stamnummer = CONVERT(varChar(8), '" & stamNr & "')"
set rsUpdateGeb = conMed.Execute (sqlUpdateGeb)
Thanks