Solved

SQL Encoding: With ADO

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DNS, website, godaddy 6 71
Best Practice CSS floating images 2 32
Adding a hidden div to each row in a table 6 60
get multiple images to align right 5 41
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

930 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

13 Experts available now in Live!

Get 1:1 Help Now