LKW
LKW

Reputation: 180

OracleDataAdapter.Update cannot update database

Using Command As OracleCommand = conn.CreateCommand()
                    Command.CommandText = sSql
                    rsLFExcelRaw = New OracleDataAdapter(Command)
                    cbOracleCmdBuilder = New OracleCommandBuilder(rsLFExcelRaw)

                    dsLFExcelRaw = New DataSet()
                    rsLFExcelRaw.Fill(dsLFExcelRaw, "LF_EXCEL_RAW")
                End Using

As stated above, I have a oraclecommand and oracledataadapter, I can retrieve data from database.

Then I update some value and add a new rows to the dataset, and do following:

dsLFExcelRaw.Tables(0).Rows.Add(row)
dsLFExcelRaw.AcceptChanges()
rsLFExcelRaw.Update(dsLFExcelRaw, "LF_EXCEL_RAW")

However, I cannot update the databse. Any ideas?

Upvotes: 0

Views: 326

Answers (1)

LKW
LKW

Reputation: 180

problem solved, after dsLFExcelRaw.AcceptChanges(), no change will be made. So I change it to:

rsLFExcelRaw.Update(dsLFExcelRaw, "LF_EXCEL_RAW")
dsLFExcelRaw.AcceptChanges()

Upvotes: 2

Related Questions