Solved

SQL Encoding: With ADO

Posted on 1998-11-04
2
231 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
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn how to dynamically set the form action using jQuery.
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now