问题描述
通过微软提供的OracleClient方式完全没问题,但改成oracle提供的OracleDataProviderfor.NET(ODP.net)方式报错DynamicSQLgenerationfailed.Eithernobasetableswerefoundormorethanone在Oracle.DataAccess.Client.OracleCommandBuilder.GetBaseTableName下面代码using(OracleConnectionoraConnection=newOracleConnection(Database.ConnectionString)){DataTabledt=null;//要插入或更改的数据stringselSql="selectdistinct*fromxxx";stringtableName="xxx";OracleDataAdapteradapter=newOracleDataAdapter(selSql,oraConnection);OracleCommandBuildercb=newOracleCommandBuilder(adapter);DataTabletemp=newDataTable(tableName);intcount=adapter.Fill(temp);if(temp.Rows.Count==0){//插入新记录for(inti=0;i<dt.Rows.Count;i++){DataRowdr=temp.NewRow();for(intj=0;j<dt.Columns.Count;j++){dr[temp.Columns[j].ColumnName]=dt.Rows[i][j];}temp.Rows.Add(dr);}}varcount2=adapter.Update(temp);//报错行adapter.UpdateBatchSize=1024;}
解决方案
解决方案二:
估计是oracle的ODP.net的版本和支持问题,我记得ODP.net相当挑环境的。