error syntax NET

error syntax NET

Postby felmarla » Mon 05 Dec 2005 14:47

As it is the syntax of the handling of execution of cursors in NET since it leaves syntax error to me surrounds to all and I have asi.
pgcoman.CommandText=("fetch all in \"ref\"");
Posts: 5
Joined: Thu 24 Nov 2005 14:16

Postby SecureGen » Mon 05 Dec 2005 15:17

Such code works ok in my tests. Please make sure that you open and fetch cursor in the same transaction.

PgSqlCommand cursorCmd = new PgSqlCommand("fetch all in \"dept\"", pgSqlConnection);
// need to start transaction, because cursor is acessible only in transaction
PgSqlTransaction tr = pgSqlConnection.BeginTransaction();
try {
// Opens named cursor

// fetch data from named cursor
PgSqlDataReader dataReader = cursorCmd.ExecuteReader();

while (dataReader.Read()) {
object obj = dataReader.GetValue(0);


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

Return to dotConnect for PostgreSQL