Last post Jan 16, 2011 05:43 PM by nickzde
Aug 04, 2010 06:09 PM|Shaynej|LINK
I have an EntityDatasource that is bound to several TextBoxes used for querying (filtering) data in a ListView. The problem I am having is getting a DateTime to work. I just want to ignore the time portion of the variable and only look at the Date portion.
Here is the markup I am using to generate the where clause. Does anyone know how to force it to just "drop" the time in the comparison?
IS NOT NULL) THEN
it.[CallerName] LIKE '% + @CallerName + "%"
it.[CallID] IS NOT NULL
WHEN (@CallDate IS NOT NULL) THEN
it.[TimeIn] = @CallDate
it.[callID] IS NOT NULL
Aug 05, 2010 02:08 AM|tanatrajan|LINK
use the syntax CONVERT(VARCHAR, ClosedDate, 101) where ClosedDate is your date variable and it may be a column or parameter.
Aug 05, 2010 02:14 AMemail@example.com|LINK
when you use Dt = yourparameDateTime
this is not match, due to time field
so your can convert your date time like
where Convert(nvarchar, it.[TimeIn],104) = convert(nvarchar, @CallDate,104)
Both side equal format
it will work
Aug 05, 2010 09:19 AM|Shaynej|LINK
How do I do this inside the ENTITYDATASOURCE like my code example? I tried adding it and I get:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Jan 16, 2011 05:43 PM|nickzde|LINK
Hello Shaynej, I am trying to do something very similar. Could you please post the part of your code which "takes" date from textbox and processes it for use in WhereParameters? Also, have you resolved the problem you had with it? Thank you.