this is my procedure
Create PROC[dbo].[EventLog_Search2]
(
@min AS DATETIME = NULL,
@max AS DATETIME = NULL
)
AS
SELECT
[idx],
[eventName],
[userIdx],
[description],
[ip],
[status],
creationDate,
[visible]
FROM eventLog cc
WHERE cc.Visible = 1 and
cc.[creationDate] >= @min AND
cc.[creationDate] <= @max
and I am Executing it like
EXEC [dbo].[EventLog_Search2]
@min = '28/12/2013',
@max = '10/03/2014'
and i am getting this error
"Msg 8114, Level 16, State 5, Procedure EventLog_Search2, Line 0
Error converting data type varchar to datetime."
My value is in "dd/mm/yyyy" format.
i Also tried this
cc.[creationDate] >= convert(datetime,@min,103) AND
cc.[creationDate] <= convert(datetime,@max,103)
But noting happening same error occurred
C# Code
SqlCommand cmd = new SqlCommand("EventLog_Search2", DALHelper.GetConnection());
cmd.Parameters.AddWithValue("@min", cls.min);
cmd.Parameters.AddWithValue("@max", cls.max);
SqlConnection con = cmd.Connection;
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
using (con)
{
SqlDataReader dr = cmd.ExecuteReader();