I have an asp.net application with a web form and a database backend. Entries in the web form are used to update the database using SQL queries. In my code, I replace quotes in form entries with a sequence of characters so as not to break the SQL. Is there an easier way to handle quotes?
For example
if var1=textbox1=mary's house
the following sql will break:
update x set field1='var1';
Thanks in advance for any help.
Koteswararao MallisettiPosted Apr 2, 2011, 3:29 AM
if(@course is not null)
begin
if(@Title is not null)
set @statement=@statement+' and course ='''+@course+''''
else
set @statement=@statement+' where course ='''+@course+''''
end