Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Using querystring in code behind

  Asked By: Jodon    Date: Feb 09    Category: Asp.net    Views: 3573
  

I have some problem with querystring
It works well when i put the querystring in aspx page
but it give me some problem when i try to put it in code behind file .aspx.cs


cmdWBTS = New SqlCommand( strQuery, con3G );
cmdWBTS.Parameters.Add( New SqlParameter
("@SiteCode",Request.QueryString("WSiteCode"))) ;

can anyone help me to deal with this problem?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Abasi Massri     Answered On: Feb 09

What error message do you get?

 
Answer #2    Answered By: Rhys Evans     Answered On: Feb 09

When you want to use a querystring value
you should first convert or cast it to the
appropriate type:


string query = Convert.ToString(Request.QueryString("WSiteCode"))


then use the string 'query' in your code.

 
Didn't find what you were looking for? Find more on Using querystring in code behind Or get search suggestion and latest updates.




Tagged: