Quando vado per modificare un record fa finta di modificarmi i campi fine e inizio (dove c'è una data)codice:<% If Request.querystring("mode") = "updatedb" then strUserName = Session("userName") strHeading = Request.Form("txtHeading") strContent = Request.Form("txtContent") strID = Clng(Request.Form("txtID")) tipoNews = Request.Form("tipoNews") strHeading = fieldReplace(strHeading) strContent = fieldReplace(strContent) strSQL = "UPDATE tblnews SET tblnews.heading='" & strHeading & "',tblnews.content='" & strContent & "',tblnews.postedby='" & strUserName & "',tblnews.Timestamp='" & date() & "'," & "tblnews.tipo =" & tipoNews & " WHERE ID =" & strID adoCon.Execute(strSQL) Set adoCon = Nothing Response.Redirect"news.asp?mode=listnews" End If %> <% If Request.querystring("mode") = "view" then userAdmin = Session("userAdmin") Set rsSettings = Server.CreateObject("ADODB.Recordset") strSettingsSQL = "SELECT shownum,contentbgcolor,infobgcolor,infotextcolor,bordercolor,headbgcolor FROM tblsettings" rsSettings.Open strSettingsSQL, adoCon Set rsViewNews = Server.CreateObject("ADODB.Recordset") if session("UserAdmin") = 2 or session("UserAdmin") = 3 then strViewSQL = "SELECT TOP " & rsSettings("shownum") & " heading, [ID], [Timestamp], postedby, IdUser, img, content, attiva, giorni FROM tblnews WHERE IdUser = " & Session("userID") & " AND attiva = true ORDER BY [ID] DESC" elseif session("UserAdmin") = 1 then strViewSQL = "SELECT TOP " & rsSettings("shownum") & " heading, [ID], [Timestamp], postedby, img, content, attiva, giorni FROM tblnews ORDER BY [ID] DESC" end if rsViewNews.Open strViewSQL, adoCon dim newsSI newsSi=0 Do While NOT rsViewNews.EOF newsSi = newsSi+1 %>
allora ho fatto delle modifiche allo script in questo modo:
<%
Ma il browser mi da errore:codice:If Request.querystring("mode") = "updatedb" then strUserName = Session("userName") strHeading = Request.Form("txtHeading") strContent = Request.Form("txtContent") strID = Clng(Request.Form("txtID")) tipoNews = Request.Form("tipoNews") strHeading = fieldReplace(strHeading) strContent = fieldReplace(strContent) strSQL = "UPDATE tblnews SET tblnews.heading='" & strHeading & "',tblnews.content='" & strContent & "',tblnews.Inizio='" & strInizio & "',tblnews.Fine='" & strFine & "',tblnews.postedby='" & strUserName & "',tblnews.Timestamp='" & date() & "'," & "tblnews.tipo =" & tipoNews & " WHERE ID =" & strID adoCon.Execute(strSQL) Set adoCon = Nothing Response.Redirect"news.asp?mode=listnews" End If %> <% If Request.querystring("mode") = "view" then userAdmin = Session("userAdmin") Set rsSettings = Server.CreateObject("ADODB.Recordset") strSettingsSQL = "SELECT shownum,contentbgcolor,infobgcolor,infotextcolor,bordercolor,headbgcolor FROM tblsettings" rsSettings.Open strSettingsSQL, adoCon Set rsViewNews = Server.CreateObject("ADODB.Recordset") if session("UserAdmin") = 2 or session("UserAdmin") = 3 then strViewSQL = "SELECT TOP " & rsSettings("shownum") & " heading, [ID], [Timestamp], postedby, IdUser, img, inizio, fine, content, attiva, giorni FROM tblnews WHERE IdUser = " & Session("userID") & " AND attiva = true ORDER BY [ID] DESC" elseif session("UserAdmin") = 1 then strViewSQL = "SELECT TOP " & rsSettings("shownum") & " heading, [ID], [Timestamp], postedby, img, content, inizio, fine, attiva, giorni FROM tblnews ORDER BY [ID] DESC" end if rsViewNews.Open strViewSQL, adoCon dim newsSI newsSi=0 Do While NOT rsViewNews.EOF newsSi = newsSi+1 %>
Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.
modifica_news.asp, line 521
la riga 521 è: adoCon.Execute(strSQL)
la riga 520 è: strSQL = "UPDATE tblnews SET tblnews.heading='" & strHeading & "',tblnews.content='" & strContent & "',tblnews.Inizio='" & strInizio & "',tblnews.Fine='" & strFine & "',tblnews.postedby='" & strUserName & "',tblnews.Timestamp='" & date() & "'," & "tblnews.tipo =" & tipoNews & " WHERE ID =" & strID
Che succede???![]()
![]()
![]()

Rispondi quotando