[DUG] Need help in special charector while inserting in a table
Robert martin
rob at chreos.co.nz
Wed Aug 27 09:07:36 NZST 2008
Agreed. It is almost always best to use the paramByname().asString (or
whatever) than to play with SQL strings. This is especially true where
dates are involved :)
Rob
Edward Koryagin wrote:
> Always use parameters to avoid troubles with datetime and special
> characters.
>
> INSERT INTO X VALUES ( :p1 );
> // this is for ADO
> with Parameters do
> begin
> ParseSQL( SQL.Text, true );
> ParamByName(p1).Value := 'dfsa sdfasdf''ads asdf';
> end;
> ExecSQL;
>
> Edward Koryagin
>
>
> ----- Original Message ----
> From: Vikas... <vikas.image at gmail.com>
> To: delphi at delphi.org.nz
> Sent: Monday, 25 August, 2008 6:39:57 PM
> Subject: [DUG] Need help in special charector while inserting in a table
>
> Hi
>
> I am using delphi and sql server 2000. I am facing a issue while
> inserting a value to a database
>
> TABLE x
>
> INSERT INTO X VALUES('VIKAS`S');
>
> this statement fails. If you see the above query there is a ` value in
> the string. When i fire this query in query analyser it goes well.
>
> But when i use the same using delhi tquery execsql. It fails.
>
> I tried D``costa for example than D`costa it works. But this changes
> the name completely. So any ideas how to handle (`) this one.
>
> Regards
> Vikas
>
> --
> vikas
>
> Need a holiday? - Yahoo!Xtra Travel
> <http://us.rd.yahoo.com/evt=55627/*http://nz.travel.yahoo.com/>
> ------------------------------------------------------------------------
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: unsubscribe
More information about the Delphi
mailing list