sidd

sidd

  • NA
  • 3
  • 0

select from DataTable does not return a row

Oct 9 2003 3:19 PM
First off, I know it would probably be more appropriate to put this in the ADO.NET section, however it is quite dead. Here is the problem: I can successfully insert a DataRow with a key of type System.DateTime in the DataTable, I know this because if I use a foreach on myDataTable.Select(), i can compare a DataTime to the appropriate field and a identify the row i want ie: DataTable dt = GetLogDatabase(); DateTime dtCurrent; //FIXME: stupid, stupid,stupid.... foreach (DataRow dRow in dt.Select()) { dtCurrent = (System.DateTime)dRow["event_id"]; if(dtCurrent == sdEventId) { return dRow; } } return null; (all done within a Monitor to prevent race conditions, of course) What is getting me is that this select statement dosen't do the same thing: DataRow[] drRow = dtTable.Select("event_id = '" + dtCurrent + "'"); Any ideas? The same select works for a key that is a string, so i'm not qute sure what the problem is. Thanks in advance -bryan ps:for some reason, the formatting gets screwed up when this form is submitted. sorry for the illegibility of the nested code

Answers (1)