SqlDataSource chargesDS = (SqlDataSource)lv2Item.FindControl("charges_gv_datasource");
string sql = "WITH relevant_ids AS (SELECT ir.result_id AS relevant_result_id FROM inspection_result_tbl ir WHERE ir.inspection_job_id= '" + incidentID.Text + "') SELECT ir.charge_id, COLLECT(ir.result_id) AS result_ids, ch.charge_progress, ch.claim_verification, ch.hours_allowed, ch.sap_notification, ch.total_checked, ch.charge FROM inspection_result_tbl ir LEFT JOIN relevant_ids ON ir.result_id=relevant_ids.relevant_result_id LEFT JOIN charges_tbl ch ON ir.charge_id=ch.charge_id WHERE ir.charge_id IS NOT NULL GROUP BY ir.charge_id, ch.charge_progress, ch.claim_verification, ch.hours_allowed, ch.sap_notification, ch.total_checked, ch.charge";
chargesDS.SelectCommand = sql;
我有一个数据源,我给它上面显示的选择命令,但它给了我错误:
遇到不支持的Oracle数据类型USERDEFINED。
使用堆栈跟踪:
[NotSupportedException: Unsupported Oracle data type USERDEFINED encountered.]
System.Data.OracleClient.OracleColumn.Describe(Int32& offset, OracleConnection connection, OciErrorHandle errorHandle) +384881
System.Data.OracleClient.OracleDataReader.FillColumnInfo() +311
System.Data.OracleClient.OracleDataReader..ctor(OracleCommand command, OciStatementHandle statementHandle, String statementText, CommandBehavior commandBehavior) +163
System.Data.OracleClient.OracleCommand.ExecuteReader(CommandBehavior behavior) +268
System.Data.OracleClient.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior) +9
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +19
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +221
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +573
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +161
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2790902
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +27
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261
BMW.XSAPPS.RR.PartsQuality.SandboxPart.SandboxPartUserControl.setChargesGV() +891
BMW.XSAPPS.RR.PartsQuality.SandboxPart.SandboxPartUserControl.populatePage(Boolean filterActive) +5827
BMW.XSAPPS.RR.PartsQuality.SandboxPart.SandboxPartUserControl.Page_Load(Object sender, EventArgs e) +1310
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.AddedControl(Control control, Int32 index) +350
BMW.XSAPPS.RR.PartsQuality.SandboxPart.SandboxPart.CreateChildControls() +155
System.Web.UI.Control.EnsureChildControls() +146
System.Web.UI.Control.PreRenderRecursiveInternal() +61
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
有关如何解决此错误的任何想法?我认为这与COLLECT部分有关。
感谢。
答案 0 :(得分:1)
我只是通过替换
来解决这个问题 using System.Data.OracleClient;
带
using Oracle.DataAccess.Client;
您还必须为上述更改添加参考:Oracle.DataAccess