DATETIME MYSQL & ASP CLASSIC

Bonovro

New Member
I'm trying to pass a parameter date to a function using asp classic :i have the format datetime : 2012-02-22 00:00:00 in my database , but my parameter will contain just '2012-02-22'so it doesnt work i receive an empty rs .\[code\] <!--#include file="JSON.asp" --><!--#include file="JSON_UTIL_0.1.1.asp" --><%function concours(datedp)Dim sConnection, objConn , objRS Const adCmdText = &H0001Const adOpenForwardOnly = 0Const adLockReadOnly = 1 BD_serveur = "localhost" BD_utilisateur = "root" BD_password = "" BD_nom = "emploipublic" 'datedp= "2012-02-22" sConnection ="DRIVER={MySQL ODBC 5.1 Driver}; SERVER=" & BD_serveur & ";UID=" & BD_utilisateur & ";pwd=" & BD_password & ";database=" & BD_nom & ";option=3;"Set conn = Server.CreateObject("ADODB.Connection")conn.Open(sConnection)Set cmd = Server.CreateObject("ADODB.Command")cmd.CommandType = adCmdText Set cmd.ActiveConnection = conncmd.CommandText = "SELECT * FROM concours WHERE DATE(dateDepot)='"& datedp & "'"Set rs = Server.CreateObject("ADODB.Recordset")rs.Open cmd, ,adOpenForwardOnly,adLockReadOnly Dim jsonObjectSet jsonObject = New JSON 'JSON class is in the include file json.asp'jsonResult = jsonObject.toJSON(Empty, rs, False) Response.ContentType = "application/json" Response.Write jsonResultend function concours("2012-02-22")\[/code\]
 
Top