Kevin,
I am trying to do something similar...I am getting lost a little on the
references to "expression column"...and their not supporting operators on
DateTime....I am not sure if that is in fact my issue...code sample
follows....
I am trying to simply apply a filter, two-of-three columns are date
types...My DataView.Count is zero after the filter is set....see code snip...
/**************
// 2) get the EventLogKey from the Event History table
DataView dvEventHist =
this.m_ds.Tables[TABLE_EVENT_HISTORY].DefaultView;
string filter = String.Format("TagName = '{0}' and DateTime =
#{1}# and DetectDateTime = #{2}#",
drv["Event"],
drv["EventTime"],
drv["DetectionTime"]);
dvEventHist.RowFilter = filter;
// QWERTY --- manually search the event history
bool found = false;
foreach (DataRow dr in this.m_ds.Tables[TABLE_EVENT_HISTORY].Rows)
{
if (dr["TagName"].Equals(drv["Event"]) &&
dr["DateTime"].Equals(drv["EventTime"]) &&
dr["DetectDateTime"].Equals(drv["DetectionTime"]))
{
found = true;
}
found = false;
}
// QWERTY -- try selecting from the datatable....also does not
work
DataRow[] selRows =
this.m_ds.Tables[TABLE_EVENT_HISTORY].Select(filter);
if (selRows.Length 0)
{
}
**************/
I do not understand why the DataView.RowFilter (and apparently also the
DataTable.Select(filter) ) do not make row matches...when cycling through the
rows manually I find what I expect...???
OK...so maybe that is what I have to do...I do not understand WHY...?
Thanks.
"Kevin Yu [MSFT]" wrote:
Hi Randy,
I agree with Nicholas. Since the expression column doesn't support
operators on DateTime, we have to go through each row and do the comparison
on our own.
Kevin Yu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
(This posting is provided "AS IS", with no warranties, and confers no
rights.)