UpdateRowSource.FirstReturnedRecord

UpdateRowSource.FirstReturnedRecord

Postby gelny » Tue 30 Jan 2007 11:26

Hi,

i have in code for MSSQL :

DbDataAdapter da = DataFactory.CreateDataAdapter("Select * from ServiceConfig", connection);
DataFactory.CreateCommandBuilder(da);
((SqlDataAdapter) da).InsertCommand.CommandText += "; Select * from ServiceConfig WHERE ID=@@IDENTITY";
((SqlDataAdapter) da).InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
da.Fill(dataSet, "ServiceConfig");

now i rewrite application to PostGre and when i call Update on DataSet from code :

DbDataAdapter da = DataFactory.CreateDataAdapter("Select * from network", connection);
DataFactory.CreateCommandBuilder(da);
((PgSqlDataAdapter)da).InsertCommand.CommandText += "; Select * from network WHERE id=currval('network_id_seq')";
((PgSqlDataAdapter)da).InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
da.Fill(dataSet, "network");

show me error :

CoreLab.PostgreSql.PgSqlException: cannot insert multiple commands into a prepared statement
at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)

What is bad??????

Gelny
gelny
 
Posts: 2
Joined: Tue 30 Jan 2007 11:00

Postby Alexey » Tue 30 Jan 2007 12:16

Protocol 3.0 doesn't support multiple query execution.
To enable this, set Protocol=2.0 in your connection string.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby gelny » Fri 02 Feb 2007 07:37

Thanks,

it works, but now it is showing error:

CoreLab.PostgreSql.PgSqlException: ERROR: currval of sequence "network_id_seq" is not yet defined in this session

at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)


Why?
gelny
 
Posts: 2
Joined: Tue 30 Jan 2007 11:00

Postby Alexey » Mon 05 Feb 2007 15:02

Please send us small test project if possible to reproduce the problem.
Include the definition of your own database objects.
Use e-mail address provided in the Readme file.
Do not use third party components.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby Alexey » Fri 09 Feb 2007 16:11

We have fixed the problem.
Look forward to the next build.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby Alexey » Mon 19 Feb 2007 14:49

After deeper investigation we found out that the problem is actually in your code. When you are trying to perform a SELECT the current value of "network_id_seq" sequence is not defined yet. You can check this with PgAdmin. For more information please consult PostgreSQL documentation.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for PostgreSQL