none
dataset refresh problem RRS feed

  • Question

  • Hi,
    I have a dataset that I populate with a table from an Oracle database.  I then add a new row and call the databaseAdapter update method which gets the data into Oracle.  However, the Oracle table has trigger that populates one of the fields of the new record - it also happens to be the primary key.  How can I retrieve this value?  The dataset reflects it as being dbnull.

    Here's an example of the code:

     

    Dim ds As dataset

     

    Dim sqlBuilder As OracleClient.OracleCommandBuilder

     

    Me.dbOraAdapter = New OracleClient.OracleDataAdapter("select * from a01_rpr_client", me.ConnectionString)

    sqlBuilder =

    New OracleClient.OracleCommandBuilder(Me.dbOraAdapter)

     

    Me.dbOraAdapter.Fill(ds)

     

    'add an empty row:

    dim dr as datarow

    dr = ds.Tables(0).Rows.Add

    dr.Item("field1")="test"
    dr.item("fied2")="hello"

     

    Me.dbOraAdapter.Update(ds)

     

     

    'sent the data to the database collector table

     

    'now fetch the row id that was generated

     

     

    Me.rowID = dr.Item("row_id")



    rowID is always dbNull instead of the value found in oracle which is a long int


    Any ideas?
    thanks

    Friday, August 21, 2009 3:26 PM

Answers

All replies