How to convert a Request.Query string to an integer value. I tried all of Convert.ToInt32 and Int32.Parse, but it says the input line is not in the correct format. I use a string value as an input to a stored procedure that accepts only integer types for this field.
Here's the piece of code -
string rid=Request.QueryString["RID"];
lblRID.Text = rid;
int id= Int32.Parse(rid);
if (lblRID.Text!= null)
SqlCommand myCommand = new SqlCommand("usp_NewResource_get", myConnection);
myCommand.Parameters.AddWithValue("@RID",id); //RID is int in database and stored procedure
myCommand.CommandType = CommandType.StoredProcedure;
Headscratcher
source
share