Hey Peeps,
I have a small (possibly stupid) error happening in my code. Not sure why it is happening but I do hope someone on here can shed some light on this.
First things first, I have a dataset that requests a single value from the database:
SELECT [menu$IsActive] FROM [Menu$Main] WHERE ([menu$NavURL] = @NavigateURL) AND ([menu$Host] = @Host)
In my code, I have the following (on the Page_Load event handler):
bool MenuIsActive = bool.Parse(taMenuBack.GetCurrentMenuState(HttpContext.Current.Request.Url.ToString(), HttpContext.Current.Request.URL.Host).ToString());
if (MenuIsActive)
{
btnChangeStatus.Text = "Set to Inactive";
} else {
btnChangeStatus.Text = "Set to Active";
}
When previewing the page, it gives me 'String was not recognized as a valid Boolean' . The SQL query in the dataset is set to 'Scalar' and the return result is definitely a boolean (the actual column type returning is 'bit'). When I do this:
string testString = taMenuBack.GetCurrentMenuState(HttpContext.Current.Request.Url.ToString(), HttpContext.Current.Request.URL.Host).ToString()
It returns "True". Any ideas?