"cannot insert multiple commands into a prepared statement"

"cannot insert multiple commands into a prepared statement"

Postby jeffc » Tue 10 Jan 2006 14:58

I'm building tables, and combining all the statements for a table into one command with semicolons terminating each command. This worked fine with the ODBC drivers, but I get the above error message when I use the coreLab driver.

The code is:

oCmd.CommandText =
"CREATE TABLE Payments ( " +
"PaymentsKey GUID PRIMARY KEY, " +
"LastUpdate TIMESTAMP NOT NULL, " +
"PaymentAmount NUMERIC(11,2) NOT NULL, " +
"PaymentType INTEGER NOT NULL, " +
"PaymentNumber VARCHAR(20) NOT NULL, " +
"DocPaidKey GUID NOT NULL ); " +
"CREATE INDEX PayTrans ON Payments(TransactionsKey); " +
"CREATE INDEX PayDoc ON Payments(DocPaidKey, PaymentsKey); ";
oCmd.ExecuteNonQuery();

Should I be using something other than the CommandText, ExecuteNonQuery() combination?

Thanks
jeffc
 
Posts: 8
Joined: Thu 05 Jan 2006 17:21

Postby SecureGen » Tue 10 Jan 2006 15:33

You should use PgSqlScript component.
SecureGen
Devart Team
 
Posts: 133
Joined: Thu 08 Sep 2005 06:27


Return to dotConnect for PostgreSQL