Solved

SQL Encoding: With ADO

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

Industry Leaders: 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

Suggested Solutions

"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,…
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

733 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