469,325 Members | 1,578 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,325 developers. It's quick & easy.

Replacing Quotation marks in SQL

1
Hi.

I came across this site while looking for a function to replace Quotation marks in SQL.

This is my code.

<!-- Begin Code -->

Intro = Replace(Intro,"'","''")
Text = Replace(Text,"'","''")



SQL = "Insert Into Articles(AuthorId,CatId,TopstoryId,Headline,Subhea dline,Intro,Text) Values ('" & Request("AuthorId") & "','" & Request("CatId") & "','" & Request("TopStoryId") & "','" & Request("Headline") & "','" & Request("Subheadline") & "','" & Intro & "','" & Text &"')"

<!-- End Quote -->


Now the problem I have is that when I execute my sql server statement no value is written in the database for Intro and Text, can anyone see where I am going wrong?
Mar 6 '07 #1
1 1578
dorinbogdan
839 Expert 512MB
Text could be a reserved word, use other var name instead, i.e. strText:
Expand|Select|Wrap|Line Numbers
  1. Intro = Replace(Intro,"'","''") 
  2. strText = Replace(strText,"'","''")
  3.  
  4. SQL = "Insert Into Articles 
  5.      (AuthorId, CatId, TopstoryId, Headline, Subheadline, Intro, [Text]) 
  6.     Values ('" & Request("AuthorId") & "','" & 
  7.              Request("CatId") & "','" & 
  8.                            Request("TopStoryId") & "','" & 
  9.              Request("Headline") & "','" & 
  10.               Request("Subheadline") & "','" & 
  11.              Intro & "','" & 
  12.               strText & "')"
  13.  
Mar 6 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by J. Muenchbourg | last post: by
8 posts views Thread by Stephen Poley | last post: by
63 posts views Thread by Tristan Miller | last post: by
4 posts views Thread by Thomas Miskiewicz | last post: by
reply views Thread by Aaron Deskins | last post: by
31 posts views Thread by The Bicycling Guitarist | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by mdpf | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.