473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Quotes in SQL statement

1
I'm trying to upload some text to a basic CMS but am having problems whenever a "double quote" is included. I've run a replace function which elminates 'single qoutes' which works fine but I can't for teh life of me me see why the double are creating a problem.

my replace function is as follows:

function fixQuotes(strData)
fixQuotes=Replace(strData,chr(39),chr(39) & chr(39))
fixQuotes=Replace(fixQuotes,"dog","cat")
fixQuotes=Replace(fixQuotes,chr(34),chr(34) & chr(34))
fixQuotes=Replace(fixQuotes,"""", "\""", 1, -1, 1)
fixQuotes=replace(fixQuotes, chr(34), "”")
fixQuotes=Replace(fixQuotes,"boy", "girl")
end function

(as you can see I've tried everyting)

and the portion of code that is supposed to prepare my SQL statement is :

body = fixQuotes(request.form("body"))
title = fixQuotes(request.form("title"))

SQLstmt = "UPDATE Messages Set Title = '"& title & "',"
SQLstmt = SQLstmt & "Description='" & desc & "',"
SQLstmt = SQLstmt & "body='" & body & "',"
SQLstmt = SQLstmt & "startdate='" & MediumDate(Startdate) & "',"
SQLstmt = SQLstmt & "enddate='" & MediumDate(Enddate) & "',"
SQLstmt = SQLstmt & "alert='" & Alert & "' "
SQLstmt = SQLstmt & "WHERE ID='" & request.form("ID") & "'"

Set RS = objConn.execute(SQLstmt)

Any help would stop me from going mad and kicking my cat...again.
Oct 31 '06 #1
1 1757
nedu
65
Hi,

First of all u try to print the "SQLstmt " in the browser. And then copy that code and paste in the query analyzer and check wheather it z working thr. And then go ahead . ..


Regards

(Nedu . . . )
Nov 2 '06 #2

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

Similar topics

5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
3
by: Stefania Scott | last post by:
How do I resolve the problem of passing a string that has quotes within in a SQL statement? Sometimes the string contains a single quote (') and some others it contains the double quote (")? Any...
2
by: Wayne | last post by:
This is probably simple but: The following portion of an SQL statement that I've copied from the SQL view of the query grid (the query works fine) is giving me an error to the effect that it is...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
2
by: ncsthbell | last post by:
I am trying to construct a 'Copy' statement in Access 2000 vb that I will actually write out to create a .bat file. My problem is that I need to put quotes around the vcFileFrom and vcFileTo...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.