Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use a querystring with a non-integer??

Status
Not open for further replies.

andre2

Technical User
May 10, 2001
4
0
0
US
Hi guys,
I''m trying to use the querystring with a non-integer in my C# ASP+ page. But I don't know how to tell the querystring not to convert my variable into an integer. This is my code:

// Obtain fullname from QueryString
int fullname = Int32.Parse(Request.Params["fullname"]);

I type filename.aspx?fullname=Variable in my browser and I get a "string not in correct format" error. If I use an integer, it works. I don't want an integer though, so I need to find out how to tell it to use a charachter input instead.

Thanks in advance.
 
You're asking Int32 to parse a string that is NOT an integer. Int32.Parse("32") will return an int of 32

Int32.Parse("bob") will produce an exception, I don't know about you, but I can't pull a number out of "bob" either.

String s = Request.Params["fullname"] should work..
^ Data type of the returned value from the Request... method.

int i = Request.Params["custid"]; (as long as you're using purely numeric id's in your database... that would work.

Hope this helps.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top