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

Tab Alleman talleman at Lumpsum.com
Tue Jun 13 14:44:28 CDT 2006


Have you tried stepping through it in the debugger to see what value SelectOneVisible is actually returning when it triggers the error?

> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Casey Crookston
> Sent: Tuesday, June 13, 2006 3:36 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] asp.net c# Parse Bool from DB
> 
> 
> 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:                           {
> 
>  
> 
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 



More information about the thelist mailing list