i came across a article, where it was mentioned if we want a dynamic querry to fire then use parameterized querry
e.g.
string inputcity=textb ox.text;
SqlCommand cmd = new SqlCommand("sel ect * from Customers where city=
'" + inputCity + " ' ";
Don't ever build a query this way!
as this leads to hacking.
instaed do it like this:
SqlCommand cmd = new SqlCommand("sel ect * from Customers where city = @City", conn);
SqlParameter param = new SqlParameter();
param.Parameter Name = "@City";
param.Value = inputCity;
cmd.Parameters. Add(param);
do u really think hacking problem can b solved using parameterized querry.If yes plz tell me, how hacking prob is solved .
thnx in advance
e.g.
string inputcity=textb ox.text;
SqlCommand cmd = new SqlCommand("sel ect * from Customers where city=
'" + inputCity + " ' ";
Don't ever build a query this way!
as this leads to hacking.
instaed do it like this:
SqlCommand cmd = new SqlCommand("sel ect * from Customers where city = @City", conn);
SqlParameter param = new SqlParameter();
param.Parameter Name = "@City";
param.Value = inputCity;
cmd.Parameters. Add(param);
do u really think hacking problem can b solved using parameterized querry.If yes plz tell me, how hacking prob is solved .
thnx in advance
Comment