473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Convert querystring value to boolean

I am trying to convert a string value in a querystring to a boolean value in a if statement to determine if the value in the querystring returned is true then run whats in the If statement. Tried this and even mad it CBool but get a cast exception unable to convert string to boolean.
If CStr(Request.QueryString("FileNO")) Then
Nov 30 '06 #1
2 5859
ymk
24
I am trying to convert a string value in a querystring to a boolean value in a if statement to determine if the value in the querystring returned is true then run whats in the If statement. Tried this and even mad it CBool but get a cast exception unable to convert string to boolean.
If CStr(Request.QueryString("FileNO")) Then
You can't get a Boolean value like that.

You need to compare the String with some other string to get a Boolean value.

Something like

If CStr(Request.QueryString("FileNO")) = "FileNO" Then

If the string is not "FileNO" then it will return false, else it returns true.
Dec 1 '06 #2
You can't get a Boolean value like that.

You need to compare the String with some other string to get a Boolean value.

Something like

If CStr(Request.QueryString("FileNO")) = "FileNO" Then

If the string is not "FileNO" then it will return false, else it returns true.
Thanks I don't know why I could not think of that.
Dec 1 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jason Chan | last post by:
i want to covert a querystring to float number in asp. what function should i use? i know cint() can convert string to int but how about float?
12
by: Alex | last post by:
I have a question about determining if one QueryString keys exists. The idea is, if this key exists, than its presence is enough to indicate that its value is true. For example ... ...
3
by: QuocSi | last post by:
Hi all, I have a bitsfield Structure MyBits a as boolean b as boolean c as boolean d as boolean end structure
0
by: Brian | last post by:
I've deployed a 'URL rewriter' version of our application almost two months ago and it is working great (.NET 1.1, Win2k, IIS5). Since then, I've gotten just FOUR exceptions that look like this: ...
14
by: Me | last post by:
Hi all I am getting a really bizzare error on when I convert a string into a datetime: The code is : DateTime dt1 = Convert.ToDateTime("10 Sep 2005"); Console.WriteLine(dt1.Year);
5
by: ABC | last post by:
How can I know the QueryString has a keyword or not? For our case, the querystring sometime has only a keyword contains not any value, for example, http://mysite.com/iijjkk.aspx?added I...
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
4
by: simonZ | last post by:
Why this don't work: Boolean test; String testValue; testValue="0"; test=System.Convert.ToBoolean(testValue); How can I convert string to boolean?
19
by: tshad | last post by:
I have a value in my sql table set to tinyint (can't set to bit). I am trying to move it into a boolean field in my program and have tried: isTrue = (int)dbReader and isTrue =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.