Page 1 of 1

Many SQL statement get error on Execute

Posted: Sun 22 Apr 2012 15:05
by Eden0928
Below my code:

Code: Select all

{ Memo1 Text }
CREATE TABLE animals( 
NAME VARCHAR(10) DEFAULT '' , 
SIZE INTEGER DEFAULT 0 , 
WEIGHT INTEGER DEFAULT 0 , 
AREA VARCHAR(20) DEFAULT '' , 
BMP BYTEA 
); 

CREATE TABLE biolife( 
"Species No" REAL DEFAULT 0.0 , 
Category VARCHAR(15) DEFAULT '' , 
Common_Name VARCHAR(30) DEFAULT '' , 
"Species Name" VARCHAR(40) DEFAULT '' , 
"Length (cm)" REAL DEFAULT 0.0 , 
Length_In REAL DEFAULT 0.0 , 
Notes TEXT , 
Graphic BYTEA , 
PRIMARY KEY("Species No") 
);
.
.
. // Many SQL statement

{ Run Code }
SQLConnection1.Execute(Memo1.Lines.Text, nil);
I get a error message, below this image:
Image

Posted: Mon 23 Apr 2012 12:36
by AlexP
Hello,

To have opportunity to execute several commands at once, you should enable the UnpreparedExecute option

SQLConnection1.Params.Values['UnpreparedExecute'] := 'true';

In this case, commands will be executed with no errors, however, enabling of this option will force using the 2nd protocol

Posted: Tue 24 Apr 2012 09:31
by Eden0928
Thank you :o