I am wondering what I am doing wrong in order to use the OracleDataAdapter to grab data from the database, make changes to it in my data table, then update the database with those changes using the code I have below. Can anyone shed some light on the matter? Thanks
regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.
Code:
Dim conn As OracleConnection = New OracleConnection("User Id=<<myuser>>;Password=<<mypass>>;Data Source=<<source>>")
Dim ds As New DataSet
Dim selCmd As New OracleCommand("ef_bg_test.get_adapter_test")
selCmd.CommandType = CommandType.StoredProcedure
selCmd.Parameters.Add(New OracleParameter("io_cursor_out", OracleType.Cursor, 0, ParameterDirection.Output, True, 0, 0, "", DataRowVersion.Default, Convert.DBNull))
selCmd.Connection = conn
Dim da As New OracleDataAdapter(selCmd)
da.Fill(ds)
Dim row2 As DataRow = ds.Tables(0).Rows(2)
row2(0) = "Test3"
row2(1) = "JohnDoe"
Dim row4 As DataRow = ds.Tables(0).Rows(4)
row4(0) = "Test5"
row4(1) = "JanDoe"
ds.AcceptChanges()
Dim updCmd As New OracleCommand("ef_bg_test.update_adapter_test")
updCmd.CommandType = CommandType.StoredProcedure
updCmd.Parameters.Add(New OracleParameter("column1_in", OracleType.VarChar, 50, "TestColumn1"))
updCmd.Parameters.Add(New OracleParameter("column2_in", OracleType.VarChar, 50, "TestColumn2"))
da.UpdateCommand = updCmd
Dim cb As New OracleCommandBuilder(da)
Try
da.Update(ds)
Dim dg As New DataGrid
dg.DataSource = ds
dg.DataBind()
Page.Controls.Add(dg)
Catch ex As Exception
Throw ex
Finally
conn.Close()
End Try
regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.