[thelist] asp.net c# Parse Bool from DB

Casey Crookston caseyc at IntelliSoftmn.com
Tue Jun 13 14:36:20 CDT 2006


In the database, I'm storing "True" and "False" values as BIT's.  0's or
1's.  The idea is to store True and False variables for panels which are
defined in the code behind.  pnlFubar.Visible = false;

 

Here's the line:

 

bool isVisible = Convert.ToBoolean((PageMods.SelectOneVisible(intPSID,
intSPID, "1350.aspx", "pnl1360")));

 

In the class PageMods, SelectOneVisible reads the table and returns a 0
or 1.  When I compile, there are no errors.  But when I execute the
page, I receive the following error:

 


String was not recognized as a valid Boolean. 


Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code. 

Exception Details: System.FormatException: String was not recognized as
a valid Boolean.

Source Error: 

 
Line 35: 
Line 36:                           Loans.DAL.PageMods PageMods = new
Loans.DAL.PageMods();
Line 37:                           bool isVisible =
Convert.ToBoolean((PageMods.SelectOneVisible(intPSID, intSPID,
"1350.aspx", "pnl1360")));
Line 38:                           if (!isVisible)
Line 39:                           {

 




More information about the thelist mailing list