Solved

SQL Encoding: With ADO

Posted on 1998-11-04
2
236 Views
Last Modified: 2013-12-25
I find that when I encode strings from a form with ' or `, I get errors when trying to pass this string to the ADO object for inserting into a database table; its because it think the ' or ` character is the string terminator.  This means any other fields are out of sync.

For example:

- name, message, ID, date

"joe", "it's friday", 256, #12-3-1998#

this is encoded as

"joe", "it`'`s friday", 256, #12-3-1998#

This still produces an error from ADO!

Regards
0
Comment
Question by:ossentoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 50 total points
ID: 1856094
1.
#12-3-1998# is no good for a date-variable on MS SQL (it is the right thing to do in Access though)

use this in stead:

"CONVERT(DateTime,'12-3-1998')"


2.
escape quote characters to get them into the database:

EscapedString = REPLACE(String,CHR(39),CHR(39)&CHR(39))

0
 

Author Comment

by:ossentoo
ID: 1856095
Is the REplace() function in
EscapedString = REPLACE(String,CHR(39),CHR(39)&CHR(39))

ADO, DAO, or just VBScript??

Regards

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question