I am building in C#/.NET2.0 a page that updates different columns dynamically in SQL call for example: myajaxpage.aspx?id=1111&fieldname=title
What is the correct way to build SQL query for reading column name from querystring? Is this good approach in a first place?
I tried:
cmd.CommandText = "UPDATE MyTable SET +"Request.QueryString["fieldname"]"+ = @fieldvalue WHERE id = @id";
Which works but is not secure, can you please advice how to make this query secure?