M
mlawry
Hi all,
Can anyone explain to me the reason why the following C# code doesn't
work?
DateTime timestamp = DateTime.Today;
DataTable table = new DataTable("My Table");
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Value", typeof(DateTime));
table.Rows.Add(new object[] { 1, timestamp });
table.AcceptChanges();
DataView dv = new DataView(table);
string filter = "Value = #" + timestamp.ToString("u") +
"#";
dv.RowFilter = filter;
// Sample results shown below:
// filter: Value = #2007-01-15 00:00:00Z#
// dv.Count: 0
I'm trying compare against DateTime values in the RowFilter, and (my)
logic says that dv.Count = 1. But the result is always 0. Am I missing
something?
It seems this problem only occur when using the = operator (including
Thanks,
Lawry.
Can anyone explain to me the reason why the following C# code doesn't
work?
DateTime timestamp = DateTime.Today;
DataTable table = new DataTable("My Table");
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Value", typeof(DateTime));
table.Rows.Add(new object[] { 1, timestamp });
table.AcceptChanges();
DataView dv = new DataView(table);
string filter = "Value = #" + timestamp.ToString("u") +
"#";
dv.RowFilter = filter;
// Sample results shown below:
// filter: Value = #2007-01-15 00:00:00Z#
// dv.Count: 0
I'm trying compare against DateTime values in the RowFilter, and (my)
logic says that dv.Count = 1. But the result is always 0. Am I missing
something?
It seems this problem only occur when using the = operator (including
= etc).
Thanks,
Lawry.