Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
is it a correct query ?

("UPDATE LOGIN u ,SlideShowTable s SET u.U_Email = '" + txtU_Email.Text + "',s.ImageName='" + txtImageName.Text + "',s.Description='" + txtDescription.Text + "',s.ADshop_name='" + txtADshop_name.Text + "',s.ADShop_Address='" + txtADShop_Address.Text + "',s.ADshop_city='" + txtADshop_city.Text + "',s.ADshop_mob='" + txtADshop_mob.Text + "',s.ADshop_Email='" + txtADshop_Email.Text + "' where s.UserId and u.UserId= " + userid, con);
Posted
Comments
bbirajdar 12-Mar-13 3:00am    
no

1 solution

Sorry, I'm not going to check it for correctness. (It actually depends on what is do you have in UI.) The whole idea is so wrong and dangerous, so your code should not be considered. You should never compose a query by concatenating strings, especially taken from UI. Just think about it: a text input can contain anything, including… fragment of SQL code.

This opens doors to a well-known exploit called SQL injection. Please see my past answers explaining it, with explanation of what you should do:
hi name is not displaying in name?[^],
EROR IN UPATE in com.ExecuteNonQuery();[^].

This is a great example: http://xkcd.com/327/[^].

This is not the only problem. You demonstrate the trend to work with string representation of data instead of data itself. This is very bad.

Good luck,
—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900