Re: Single quote

From: DNagel (NOTGrandNagel_at_hotmail.com)
Date: 06/16/04


Date: Wed, 16 Jun 2004 15:15:12 -0700

Shahri wrote:

> Hi all,
> How to accomplish this from VB6 against Access database:
> insert into table1(a, b, c)
> values('Name','Co'de','Desc')
> value for column b has a single quote and causing problem.
> Thanks in advance,
> Shahri
>

The other two replies cirle around the issue of single quotes
by asking you to modify your data from code... the end result
is as desired, but none-the-less it requires that you interact
with the data in a fashion that can possibly be a source of an
error... we all make errors... I certainly do <g>

I would recommed looking into using Parameterized SQL statements.
They offer the ability to push anything you want into the
database without modifying the original data, as well as offer
performance benefits such as the ability to retain your query
in the cache and not have to reparse it each time it's run.

On larger systems this yields huge resource savings and speeds
up ALL the applications that hit the database.

On smaller systems it may not show the performance benefits, but
it will allow you to pass data 'unhandled' and it's good practice
for when you hit the big-time...

Ask any dba about them to see what they think of the idea...

D.