Hello and happy new year!

 

I have a DataTable. This table contains several columns. One of them (Index
0) is the PrimaryKey (1, 2, 3…). It is filled via Trigger when null.

 

Now I’m using the following function of FbDataAdapter.cs to save my new row
to the Firebird Table:

 

FbDataAdapter.Update(DataRow[] rows, DataTableMapping dtmapping).

 

Now I would expect, that my PrimaryKey contains the value after executing
this function, but it doesn’t. I’ve had a look at the code of
FbDataAdapter.cs and found the following near line 368:

 

                        // 3. Execute the command

                        if (command.Connection.State ==
ConnectionState.Closed)

                        {

                            command.Connection.Open();

                            // Track command connection

                            connections.Add(command.Connection);

                        }

 

                        int rowsAffected = command.ExecuteNonQuery();

                        if (rowsAffected == 0)

                        {

                            throw new DBConcurrencyException(new
DBConcurrencyException().Message, null, new DataRow[] { row });

                        }

 

                        updated++;

 

I tried to modify to something like this:

 

                        // 3. Execute the command

                        if (command.Connection.State ==
ConnectionState.Closed)

                        {

                            command.Connection.Open();

                            // Track command connection

                            connections.Add(command.Connection);

                        }

 

                       IDataReader reader = command.ExecuteReader();

                        while (reader.Read())

 
Console.WriteLine(reader.GetValue(0).ToString());

 

                        updated++;

 

But I don’t get the value of the PrimaryKey at
Console.WriteLine(reader.GetValue(0).ToString());

 

How can I get the PK to set the column value of the new row?

 

Thanks for any help in advance,

André

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to