How do I reference my database column within a url string in C#?
Hi,
Within the iteminserting event of my listview control I am attempting to redirect the user to a web page that is being pre-populated by a query string variable (customer_id) from my backend db.
I am using the attached C# code on my calling page but I get the error:
"System.Web.Query.Dynamic.ParseException: Operator '=' incompatible with operand types 'Int32' and 'Object"???
The var customerID is probably an object that should be a string (use e.Values["customer_id"].ToString()).
You should also UrlEncode the querystring parameter for safety (Server.UrlEncode(customerID)).
Gary Davis
Kaushal Arora
You are using
var customerID = e.Values["customer_id"];
in this the e.Values["customer_id"] is of object type and in customerID field you want ant Int32 type value so write the statement as var customerID = Convert.ToInt32(e.Values["customer_id"].ToString());
You should also UrlEncode the querystring parameter for safety (Server.UrlEncode(customer
Gary Davis