Hi,
I am starting to pull out some reports out of an application
The report normally query the database for data of the current day
I stripped down the query to focus on the problem.
If I run this query on the SQL Server Query Analyzer it runs just fine.
Now if I try to put this query on my .asp page I got an error:
No matter what I tried I got the same error, the only way to get the query working is to put in a fixed fashion, obviously I need it to be dynamic.
The error says: Syntax error trying to convert the varchar value '09/25/2004' to a column of type int
As a note '09/25/2004' is the value of the column mt_fecha at the very first row.
Thank you in advance
Regards,
I am starting to pull out some reports out of an application
The report normally query the database for data of the current day
I stripped down the query to focus on the problem.
If I run this query on the SQL Server Query Analyzer it runs just fine.
Code:
select mt_id from m_ticket where convert(varchar,mt_fecha,101)='10/22/2004'
Now if I try to put this query on my .asp page I got an error:
Code:
<%
Dim repo__MMColParam
repo__MMColParam = "10/20/2004"
If (formatdatetime(date() ,2) <> "") Then
repo__MMColParam = formatdatetime(date() ,2)
End If
%>
<%
Dim repo
Dim repo_numRows
Set repo = Server.CreateObject("ADODB.Recordset")
repo.ActiveConnection = MM_color_tienda_STRING
repo.Source = "SELECT mt_fecha FROM m_ticket WHERE convert(varchar,mt_fecha,101)=" + Replace(repo__MMColParam, "'", "''") + ""
repo.CursorType = 0
repo.CursorLocation = 2
repo.LockType = 1
repo.Open()
repo_numRows = 0
%>
No matter what I tried I got the same error, the only way to get the query working is to put in a fixed fashion, obviously I need it to be dynamic.
The error says: Syntax error trying to convert the varchar value '09/25/2004' to a column of type int
As a note '09/25/2004' is the value of the column mt_fecha at the very first row.
Thank you in advance
Regards,