Out of range datetime value
Jeg får følgende fejlmeddelelse:The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
/workstatistics/index.asp, line 264
Min kode ser sådan her ud:
If Request.Form("WhatWasChosenX") = "InsertData" Then
Dim strDate, intWorkHours, intReadFrom, intReadTo, intPagesTotal, bitReadProject
If Request.Form("ProjektNavn") <> "" Then
strProjectName = Request.Form("ProjektNavn")
strDate = Request.Form("Date")
intWorkHours = Request.Form("WorkHours")
intReadFrom = Request.Form("ReadFrom")
intReadTo = Request.Form("ReadTo")
intPagesTotal = Request.Form("PagesTotal")
If Request.Form("ReadProject") = "on" Then
bitReadProject = 1
Else
bitReadProject = 0
End If
Set objConn = Server.Createobject("ADODB.Connection")
strConnString = "Provider=SQLOLEDB;" & _
"Persist Security Info=FALSE;" & _
"User ID=sa;" & _
"Password=pb16950;" & _
"Initial Catalog=WorkStatistics;" & _
"Initial File Name = C:\Programmer\Microsoft SQL Server\MSSQL\" & _
"DATA\WorkStatistics_Data.mdf;"
objConn.Open strConnString
strSQL = "INSERT INTO WorkProjects_T (Dags_Dato_DT, Arbejdstimer_IN," & _
"Læste_Sider_IN, Læst_Fra_IN, Læst_Til_IN, Projekt_Navn_VC," & _
"Læse_Projekt_BT) VALUES('" & strDate & "', '" & intWorkHours & "', '" & _
intPagesTotal & "', '" & intReadFrom & "', '" & intReadTo & "', '" & _
strProjectName & "', '" & bitReadProject & "')"
Set objCmd = Server.Createobject("ADODB.Command")
Set objCmd.ActiveConnection = objConn
objCmd.CommandText = strSQL
objCmd.CommandType = adCmdText
objCmd.Execute
Set objCmd = Nothing
objConn.close
Set objConn = Nothing
Response.Write "Projekt Navn Indsat: " & strProjectName & "<BR>"
Response.Write "Dato indsat: " & strDate & "<BR>"
Response.Write "Arbejdstimer indsat: " & intWorkHours & "<BR>"
Response.Write "Læseprojekt indsat: " & bitReadProject & "<BR>"
Response.Write "Læst fra: " & intReadFrom & "<BR>"
Response.Write "Læst til: " & intReadTo & "<BR>"
Response.Write "Antal læste sider indsat: " & intPagesTotal & "<BR>"
End If
End If
Jeg indsamler datoen fra en tekst box i et andet stykke kode.
Hvad er der galt?
