Which Select

Ok have a .aspx page that has a list of links to view images, one link being view all images.

<a class=nav2 href="http://www.domain.com/Images.aspx?Cat=ALL">


protected void Page_Load(object sender, EventArgs e)
        string objCatName;
        string SQL_sel_images;

        objCatName = Convert.ToString(Request.QueryString["Cat"]);

        if ( objCatName.ToString(Request.QueryString["Cat"]) = "ALL")
            SQL_sel_images = "SELECT * FROM table";


            SQL_sel_images = "SELECT * FROM table WHERE cat='" + objCatName + "'";



Compiler Error Message: CS1502: The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
The ToString() method need a format providing. I think you are maybe just trying to cast to a string, in which case you can use:

    objCatName = (string)Request.QueryString["Cat"];
These two lines make no sense

objCatName = Convert.ToString(Request.QueryString["Cat"]);
if ( objCatName.ToString(Request.QueryString["Cat"]) = "ALL")

The first one is fine but then on the second just have

if ( objCatName == "ALL")

Since objCatName is already = tje Request.QueryString["Cat"]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ziwez0Author Commented:
opppss, it been a long day, lol (no excuse)

hehe no problem, easiest points ever :)

PS: I also find Request.QueryString["Cat"].ToString() easier to code... but as carl pointed out. You can do this many different ways. Whatever works best for you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.