Dear All,
I am using:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Microsoft Visual Studio 2010 : VB Express
Microsoft .NET Framework : Version 4.0.30319 RTMRel
When I populate dataset using select query and use OracleCommandBuilder and update dataadapter, data is saved in database.
But if I put same select in store procedure and use this to populate dataset then data is not updated in db.
I get this error
Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
at
Please tell me where I am going wrong.
I am using:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Microsoft Visual Studio 2010 : VB Express
Microsoft .NET Framework : Version 4.0.30319 RTMRel
When I populate dataset using select query and use OracleCommandBuilder and update dataadapter, data is saved in database.
But if I put same select in store procedure and use this to populate dataset then data is not updated in db.
I get this error
Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
at
Code:
da1.Update(ds1, "req")
Code:
Dim conn As New OracleConnection
Dim da1 As OracleDataAdapter = New OracleDataAdapter
Dim ds1 = New DataSet
With conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = oraConnectString ' has conn info
.Open()
End With
' Define the command
Dim cmd As New OracleCommand
cmd.Connection = conn
' when I use sql query data is saved in db
' cmd.CommandType = CommandType.Text
' cmd.CommandText = "select * from request'"
' when I use stored proc data is NOT saved in db ?
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "get_all_req_data"
cmd.Parameters.Add(New OracleParameter("i_where_cond", "")) ' passing blank where cond
cmd.Parameters.Add(New OracleParameter("o_cursor", OracleDbType.RefCursor, ParameterDirection.Output))
da1.SelectCommand = cmd
da1.MissingSchemaAction = MissingSchemaAction.AddWithKey
da1.Fill(ds1, "req")
' set PK
Dim pk() As DataColumn = {ds1.Tables("req").Columns("request_no")}
ds1.Tables(0).PrimaryKey = pk
Dim cb1 As OracleCommandBuilder = New OracleCommandBuilder(da1)
' update found row for "position_profile" column
Dim r As DataRow = ds1.Tables("req").Rows.Find("710_6")
r("position_profile") = "14"
da1.Update(ds1, "req")