Hej! Jag vet inte om jag är fel ute men: SQLDate använder Access syntax. Testa med:SQL FEL! SQLState: 4 Native Error Code: 1064
jag hade besökstatistik på min hemsida men efter övergången till ett nytt webhotell och ny databas så fungerar inte min besöksstatistik. har försökt fixa den men lyckas aldrig, då vänder jag mig till pellesoft.
Webhotell: B-one
Databas: Mysql
Förut hade jag en Access databas.
Det är tydligen nått fel på SQl koden, hur ska jag lösa detta?
Felmedelande:
ADODB.Connection.1 (0x80004005)
SQLState: 4 Native Error Code: 1064 [TCX][MyODBC]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2
/counter2.asp, line 48
Kod:
<%
strHost = Request.ServerVariables("REMOTE_HOST")
strAddress = Request.ServerVariables("REMOTE_ADDR")
%>
<!--#include virtual="inc/adovbs.inc"-->
<!--#include file="inc/databas.inc" -->
<%
If Session("RemoteHost") = strHost And Session("RemoteAddress") = strAddress Then
'Besök har redan räknats
Else
strSQL = "UPDATE `counters` SET counters.CounterVisits = counters.CounterVisits + 1" & vbCrLf & _
"WHERE counters.CounterDate = " & SQLDate(Date()) & " AND counters.CounterHost = " & SQLText(strHost) & " AND counters.CounterAddress = " & SQLText(strAddress)
Connect.Execute strSQL, RecordsAffected ' <-- rad 48
%>
Är mycket tacksam för all hjälp som jag kan få.
Tack på förhand
Mvh Daniel Karlsson
Sv: SQL FEL! SQLState: 4 Native Error Code: 1064
<b>strSQL = "UPDATE `counters` SET counters.CounterVisits = counters.CounterVisits + 1" & vbCrLf & _
"WHERE counters.CounterDate = " & SQLDate(Date</b>
'borde väll vara
strSQL = "UPDATE `counters` SET counters.CounterVisits = counters.CounterVisits + 1" & _
"WHERE counters.CounterDate = " & SQLDate(Date
Du får ju in en radbrytning, och jag tror inte databasmotorn tycker om det.
Sv: SQL FEL! SQLState: 4 Native Error Code: 1064
Function SQLDate(Value)
If IsDate(Value) Then
SQLDate = "'" & Year(Value) & "-" & Right(2, "0" & Month(Value)) & "-" & Right(2, "0" & Day(Value)) & "'"
Else
SQLDate = "Null"
End if
End Function