I have a .Net application that loads a datatable from an oracle Database. The table contains a virtual column.
When I'm inserting a new row in datatable, it says :
Insert INSERT operation disallowed on virtual columns
I do understand this error but I don't know how to skip the virtual columns when saving data back to the database.
Here is my code :
Dim Command As OracleCommand
Dim TempDataAdapter As OracleDataAdapter
Dim DataSet = new DataSet
Dim Name = "MyTable"
Dim TempDataAdapter As OracleDataAdapter
Dim DataTable as DataTable
'The connection is defined somewhere else...
Command = New OracleCommand("MyTable", Me.Connection)
Command.CommandType = CommandType.Text
TempDataAdapter = New OracleDataAdapter(Command)
'Fill the table from the database
TempDataAdapter.FillSchema(DataSet, SchemaType.Source, Name)
DataTable = DataTable = DataSet.Tables(0)
And the code for saving data back to database :
TempDataAdapter.Update(DataTable)
After the creation of the datatable, I tried deleting the virtual column from the datatable : DataTable.Columns.Remove(DataTable.Columns("MyVirtualColumn"))
But when saving data back to the database, it returns the same error.
Can anyone help please ?
Cheers,
If you are not trying to populate or query the virtual column, can you create a view on that table that excludes the virtual column and work with that view.