error when qerying to mysql from an asp page

franrtorres77's Avatar, Join Date: Nov 2010
Newbie Member
Hello.

I have the following query for knowing the stopped time of some trucks of the company, this query works well in "mysql query browser" but in an asp page it tells me the next error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[MySQL][ODBC 5.1 Driver][mysqld-5.1.33-community]Unknown system variable 'timediff'

/gps/pos.asp, línea 62



the code is this:
<%
Dim paradas
Dim paradas_numRows

Set paradas = Server.CreateObject("ADODB.Recordset")
paradas.ActiveConnection = MM_trucks_STRING
paradas.Source = "set @nexttime := "", @nextms := "", @diff := ""; select velocidad,movil,fecha, concat(fecha, replace(fecha, '.', ':')) as Time, if(@nexttime<>"", timediff(@nexttime, fecha), "") as tdiff, if(@nextms<>"", abs(@nextms-fecha), "") as msdiff, if(@nexttime<>"", concat(timediff(@nexttime, fecha), replace(abs(@nextms-fecha), '0.', ':')),"") as FinalDifference, (@nexttime:=fecha) as Next, (@nextms:=fecha) as NextMS from gesconsat.posiciones where velocidad=0 and movil = 1883 and fecha >(now() - interval 2 day)"
paradas.CursorType = 0
paradas.CursorLocation = 2
paradas.LockType = 1
paradas.Open()

paradas_numRows = 0
%>


Best regards and thank you.
franrtorres77's Avatar, Join Date: Nov 2010
Newbie Member
Quote:
Originally Posted by invoftfog View Post
Hey??!
I have already solved it.