My database includes only
Truck
however my below select statment returns the rows with 'Truck'
MyWebControl.Myfunction().Select("TransportationMode = '" + TRUCK + "'");
How can I make this select statement case sensitive ?
Set DataTable.CaseSensitive
to True
.
Assuming Myfunction()
returns a DataTable:
string TRUCK = "trUck";
var dt = MyWebControl.Myfunction();
dt.CaseSensitive = True;
dt.Select("TransportationMode = '" + TRUCK + "'");
If you're at least on .NET 3.5 you could use linq
which is much more powerful and readable than the DataTable.Select
syntax.
string mode = "Truck";
var rows = table.AsEnumerable()
.Where(r = > r.Field<string>("TransportationMode") == mode);
It's case sensitive by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With