May 1, 2006 at 1:00 pm
hi everyone,
I am new in this forum. I am having a problem inserting Apostropy in database.(e.g John's).
Can anyone please come up to solve this problem. Oranyone know the solution. Will be a great help for me.
Thanks
Nazrina Afrin
May 1, 2006 at 1:29 pm
insert into MyTable (MyColumn)
values('John''s') --note the extra quote
May 2, 2006 at 11:54 am
You might want to take care of this problem on the front end using smth like that:
replace(CStr(Request.Form("LastName")),"'", "''") when inserting into DB.
May 2, 2006 at 12:03 pm
Then there's QUOTENAME()
see: http://msdn2.microsoft.com/en-us/library/ms176114(SQL.90).aspx
for reference.
May 2, 2006 at 7:22 pm
Also, if this code is coming to SQL from your client application / web application, you should read about "SQL Injection attacks" and how to prevent them... Do a search on this site.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply