oledb数据库报错汇总

(一)“对于不返回任何键列信息的 SelectCommand,不支持 UpdateCommand 的动态 SQL 生成。”
通过oleCommandBuilder和adapter的update方法更新数据库不成功,会报错:通过oleCommandBuilder和adapter的update方法更新数据库不成功,会报错:通过oleCommandBuilder和adapter的update方法更新数据库不成功,会报错:通过oleCommandBuilder和adapter的update方法更新数据库不成功,会报错:通过oleCommandBuilder和adapter的update方法更新数据库不成功,会报错:通过oleCommandBuilder和adapter的update方法更新数据库不成功,会报错:通过oleCommandBuilder和adapter的update方法更新数据库不成功,会报错:

原因:

微软C#oracle的兼容性不够好。

解决方法:

使用oracleCommandBuilder代替原始的oleDbCommanderBuilder。

 

原始代码:

                    OleDbDataAdapter adapter1 = new OleDbDataAdapter(strSql, PopedomOper.m_oleDbConn);
                    OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(adapter1);
                    adapter1.Update(PopedomOper.m_dtFulltable);

 

改正:

                    OracleConnection orclCon = new OracleConnection(strOriginalCon);
                    OracleDataAdapter orclAdapter = new OracleDataAdapter(strSql, orclCon);
                    OracleCommandBuilder thisOrclBuilder = new OracleCommandBuilder(orclAdapter);
                    orclAdapter.Update(PopedomOper.m_dtFulltable);

 

 

 

 

 

 

 

你可能感兴趣的:(oracle,报错,C#)