Page 1 of 1

"cannot insert multiple commands into a prepared statement"

Posted: Tue 10 Jan 2006 14:58
by jeffc
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

Posted: Tue 10 Jan 2006 15:33
by SecureGen
You should use PgSqlScript component.