Solved

SQL Encoding: With ADO

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to dynamically set the form action using jQuery.

635 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