Tuesday, July 17, 2007

DataTable.Select problem, not finding rows

DataTable.Select problem in ASP.NET 2.0 I have noticed a problem with the DataTable.Select statement where .NET appears to convert all the data to string format. When I tried to do a select on an integer column passing in an integer value with a length that was different from most of the other integer values in the datatable, it wouldn't return any rows. It was really odd and I think should still work. This is what I call a but in .NET Anyway, the fix is to put ticks around the integer parameter in your select statement. Here is someone else's take on the matter: The data in your table probably isn't in integer form. Depends on you xml schema if you have one. If not they are probably all text type. Depending on how much you are using the data you might also want to look into serializing your xml and putting the data into a class that inherits the arraylist. This article may be of some assistants (read part one and two). http://aspnet.4guysfromrolla.com/articles/102302-1.aspx

No comments: