c# - Get a boolean value from DataTable -
How do I get a boolean value in a dataset, I am using Visual Studio 2003, I am trying the following , But it is not working:
// If the product is inactive, do not display, and redirect to the main page ((dbDataSet.Tables ["productGeneral"]. Rows [0] ] ["Active"] I also tried, but is not working: if ((dbDataSet.Tables ["productGeneral"]. Rows [0] ["Active "". ToString () == incorrect)
The column name is "active"], the value in the column is either true or false, using SQL Server 2000
Please
You need to insert a bowl directly, and just
Have you tried?
if (((bool) dbDataSet.Tables ["productGeneral"]. [0] ["active"] == incorrect)
If it is a bool, then you want to directly insert the results into bool.
First fails because 0 is an Int32, not a B oolean. They are not comparable in C #, because they are specific types, the second fails because ToString () changes the result to a string, and you are comparing the string to a bull, which will not work again.
Comments
Post a Comment