Thats right, but my primary question is : Is inseritng the return clause 
manually the recommended way to return the value?

My code is adapted from André Litfin from his posting from Thu, 13 Nov 2008 
02:03:23 :

string selectCMD = "select ID, CAPTION, DESCRIPTION, SETTINGS fom MS_SENSOR 
order by ID ";


// Creating update and insert statements
FbCommandBuilder builder = new FbCommandBuilder(_da);
FbDataAdapter da = new FbDataAdapter();
da.UpdateCommand = builder.GetUpdateCommand();
        
da.InsertCommand = builder.GetInsertCommand();
da.InsertCommand.CommandText += " returning ID";
da.InsertCommand.Parameters.Add("RET_ID", FbDbType.BigInt).Direction = 
ParameterDirection.Output;
da.InsertCommand.UpdatedRowSource = UpdateRowSource.OutputParameters;

// create DataTable object
TblSensor = new DataTable();

.
.
.

// create new DataRow
DataRow NewRow = TblSensor.NewRow();

// Add new DataRow to DataTable
TblSensor.Rows.Add(NewRow);

//update DataAdapter
da.Update(TblSensor);


// Reading new generated primary index value
Int64 id = da.InsertCommand.Parameters["RET_ID"].Value;



Best regards - Ulrich



----- Original Nachricht ----
Von:     Jiri Cincura <disk...@cincura.net>
An:      "For users and developers of the Firebird .NET providers" 
<firebird-net-provider@lists.sourceforge.net>
Datum:   01.10.2012 13:00
Betreff: Re: [Firebird-net-provider] Returning value when executing insert
 command with FbDataAdapter

> On Mon, Oct 1, 2012 at 12:43 PM, Ulrich Groffy <ulrich.gro...@arcor.de>
> wrote:
> > it did not work
> 
> Nobody will be able to help you, without the code.
> 
> -- 
> Jiri {x2} Cincura (x2develop.com founder)
> http://blog.cincura.net/ | http://www.ID3renamer.com
> 
> ----------------------------------------------------------------------------
> --
> Got visibility?
> Most devs has no idea what their production app looks like.
> Find out how fast your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219671;13503038;y?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> Firebird-net-provider mailing list
> Firebird-net-provider@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to