I'm receiving the below exception when I launch the page for debugging. The objectDataSource is configured for an ADO TableAdapter which queries an oracle database. The ods is then bound to an ASP.NET Gridview. I am coding against .NET 4.0.
If I leave the gridview unbound, there are no problems when launching. I can do as much as completely configure the ods, define columns and row behavior for the gridview, etc, and there are no issues. I am using (to my knowledge) the same methodology that I have successfully used many times in the past to access and display the data. I've been through the code as closely as I can imagine, and haven't been able to pick out the problem.
Exception Info:
Capabilities:Type=IE7,Name=IE,Version=7.0,MajorVersion=7,MinorVersion=0,Platform=WinNT,IsBeta=False,IsCrawler=False,IsAOL=False,IsWin16=False,IsWin32=True,SupportsFrames=True,SupportsTables=True,SupportsCookies=True,Ecmascriptversion=3.0,SupportsVBScript=True,SupportsJavaApplets=True,SupportsActiveXControls=True,CDF= False
Inner Exception Type: System.Reflection.TargetInvocationException Inner Exception: Exception has been thrown by the target of an invocation.
Inner Source: mscorlib
Inner Stack Trace: at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance)
at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()
at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()
The Markup:
<asp:GridView ID="gvGradename" runat="server" AutoGenerateColumns="False"
DataKeyNames="GRADENAME_ID" DataSourceID="odsGradename">
<Columns>
//Which columns are displayed are irrelevant. The error occurs with any columns, including none.
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsGradename" runat="server"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetDataByActiveName"
TypeName="pts.PTSTableAdapters.PTS_GRADENAMETableAdapter">
</asp:ObjectDataSource>
The query:
select gn.gradename_id
, gn.mill_id
, case when gn.gradename_id = 0 then upper(gn.name) else initcap(gn.name) end name
, m.name millname
, gn.audit_id
, gn.audit_dtm
, gn.audit_insert_dtm
, gn.audit_process_code
, gn.description
, gn.roll_width_threshold
from pts_gradename gn
, pts_mill m
where gn.is_generic = 1
and gn.is_active = 1
and gn.mill_id = m.mill_id
order by case when gn.gradename_id = 0 then null else initcap(gn.name) end nulls first
I'm not doing anything with it in the code-behind, at the moment.
EDIT: included tablenames in the query, where they had been redacted, previously.
Also, I can preview the data in the table adapter, and receive the expected information, so it appears not to be a problem with the query itself.
GetDataByActiveNamejust throws an exception. Debug it carefully. - Wiktor Zychla