Converting
Jeg får denne fejlmeddelelse:Syntax error converting the varchar value 'on' to a column of data type bit.
/workstatistics/index.asp, line 260
Det ser ud til at den har et problem med den bit værdi jeg har i min database. 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")
bitReadProject = Request.Form("ReadProject")
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
Hvordan retter jeg fejlen?
