🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1612

Re: ADOCommand INSERT

#1612
From: Giuliano
Date: Tue, 01 Jun 2004 13:26
34 lines
2067 bytes
On Tue, 1 Jun 2004 14:41:25 +0200, "Zannha" <asd> wrote:

>Argh,
>
>what is wrong with this?
>
>Form1->cmd->CommandText = "INSERT INTO mapdata ";
>Form1->cmd->CommandText += "(layer, header, description, posx, posy,
>category)";
>Form1->cmd->CommandText += " VALUES ";
>Form1->cmd->CommandText +=
>"("+IntToStr(index)+",'"+header->Text+"','"+desc->Text+"',";
>Form1->cmd->CommandText +=
>IntToStr(mousex)+","+IntToStr(mousey)+",'"+cat->Text+"')";
>Form1->cmd->Execute();
>
>layer is a number field, header a text field, description a memo field, posx
>and posy number field and category a text field.
>
>I'm getting an exception saying Syntax error in INSERT INTO...
>
>Zan
>

Not shure, but I wouldn't use += operator with properties. Rather, try to
compose the SQL statement by hand, using a temporary string, the assigning it
to the CommandText property once, only after you have built it. Doing so, you
can be able even to investigate the syntactical structure of the final
statement in order to check for the error.
Even, consider to use parameters wich are "portable" between differend DBMS
engines: beware the different dates' format and numbers' format you could meet
when you are building a SQL statement by hand.

Giuliano
Technical Details
Message-ID: <8ivob092j8q8hvon5a6ph1kohptjog1u66@4ax.com>
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40bc7971$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,469aaf2ccd19f05
X-Google-Attributes: gid10698b,public
From: Giuliano <gcardinali@remove.adhoc.net>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Re: ADOCommand INSERT
Date: Tue, 01 Jun 2004 15:26:15 +0200
Message-ID: <8ivob092j8q8hvon5a6ph1kohptjog1u66@4ax.com>
References: <40bc7971$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 81.72.236.131
X-Trace: newsgroups.borland.com 1086096492 81.72.236.131 (1 Jun 2004 06:28:12 -0700)
Lines: 34
Path: arc1-ca.pugleaf.net!controlnews3.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail