"cannot insert multiple commands into a prepared statement"

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Posts: 8
Joined: Thu 05 Jan 2006 17:21

"cannot insert multiple commands into a prepared statement"

Post by 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, " +
"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); ";

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


Devart Team
Posts: 133
Joined: Thu 08 Sep 2005 06:27

Post by SecureGen » Tue 10 Jan 2006 15:33

You should use PgSqlScript component.

Post Reply