SQL structure Help

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Jan 21 15:01:24 CST 2003


on 1/21/03 2:34 PM, Wonder Fef at wonderfef at noos.fr wrote:

> 
> Hello,
> 
> I'm importing a text file into a vdb database.
> I use a SQL statement like :
> 
> INSERT INTO myTable (Field1, Field2, Field3) VALUES ('Value1', 'Value2',
> 'Value3')
> 
> It runs great excepting that Valentina refuses to insert a record if one of
> its value contains a "\" character.
> 
> Moreover, how can I insert a field which contains a ' ?
> 
> I think that some characters are used for the SQL syntax, so that a bad use
> of them leads to errors, but there must be a workaround...

Or even third the BEST IMHO way. Use binding !!!

What API you use ?

 sqlstr = "INSERT INTO myTable (Field1, Field2, Field3) VALUES (:1, :2, :3)"

now do e.g. For RB:

    dim binds as Array;

    binds(0) = str1;
    binds(1) = str2;
    binds(3) = str3;

    db.Sqlexecute( sqlStr, binds )

It is effective because you must not worry at all about escaping.

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://listserv.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list