本文介绍了ASP.NET 2.0 ObjectDataSource UpdateMethod未传递新值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 您好, 我今天开始使用ObjectDataSource。我有选择, ,并一直在努力让更新方法工作。这是 我的数据源的asp代码: < asp:ObjectDataSource ID =" dsourceApps" runat =" server" SelectMethod =" getAllApplications" TypeName =" AppMgr.AppManager" UpdateMethod =" updateAppHdr" ConflictDetection =" CompareAllValues" OldValuesParameterFormatString =" {0} _old" OnObjectCreating =" dsourceApps_OnObjectCreating" ; OnObjectDisposing =" dsourceApps_OnObjectDisposing"> < UpdateParameters> < asp:Parameter Name =" appid"类型="字符串" /> < asp:参数名称=" appname"类型="字符串" /> < asp:参数名称=" apploc"类型="字符串" /> < asp:参数名称=" appdesc"类型="字符串" /> < asp:参数名称=" appid_old"类型="字符串" /> < asp:参数名称=" appname_old"类型="字符串" /> < asp:参数名称=" apploc_old"类型="字符串" /> < asp:参数名称=" appdesc_old"类型="字符串" /> < / UpdateParameters> < / asp:ObjectDataSource> updateAppHdr函数的函数sig为: public void updateAppHdr(string appid,string appname,string apploc, string appdesc,string appid_old,string appname_old,string apploc_old ,字符串appdesc_old) 我在GridView中编辑字段 后点击保存按钮后得到的错误是: 异常详细信息:System.Data.OracleClient.OracleException:ORA-06550: 第1行,第7列: PLS-00306:错误的数字或调用的参数类型 ''ND_UPD_DEFINED_APP'' ORA-06550:第1行第7列: PL / SQL:Statement忽略了 我做了一些挖掘工作,我注意到所有新值(没有附加_old的 字段)都作为NULL进入函数。 旧的价值正在好转,但是新值只是 null ... 任何想法为什么会这样?它实际上进入了 函数,所以我猜它与 gridview的设置方式有关......我可以'似乎在谷歌上找不到任何东西, 或者我不知道该找什么... 提前致谢任何帮助, Mike 解决方案 Hello, I started working with the ObjectDataSource today. I have the select,and have been working on getting the update method to work. Here isthe asp code for my Data source: <asp:ObjectDataSource ID="dsourceApps" runat="server"SelectMethod="getAllApplications"TypeName="AppMgr.AppManager" UpdateMethod="updateAppHdr"ConflictDetection="CompareAllValues"OldValuesParameterFormatString="{0}_old"OnObjectCreating="dsourceApps_OnObjectCreating"OnObjectDisposing="dsourceApps_OnObjectDisposing"><UpdateParameters><asp:Parameter Name="appid" Type="String" /><asp:Parameter Name="appname" Type="String" /><asp:Parameter Name="apploc" Type="String" /><asp:Parameter Name="appdesc" Type="String" /><asp:Parameter Name="appid_old" Type="String" /><asp:Parameter Name="appname_old" Type="String" /><asp:Parameter Name="apploc_old" Type="String" /><asp:Parameter Name="appdesc_old" Type="String" /></UpdateParameters></asp:ObjectDataSource>The function sig for the updateAppHdr function is: public void updateAppHdr(string appid, string appname, string apploc,string appdesc, string appid_old, string appname_old, stringapploc_old, string appdesc_old) The error that I get after I hit the save button after editing a fieldin my GridView is: Exception Details: System.Data.OracleClient.OracleException: ORA-06550:line 1, column 7:PLS-00306: wrong number or types of arguments in call to''ND_UPD_DEFINED_APP''ORA-06550: line 1, column 7:PL/SQL: Statement ignoredI did some digging, and I''m noticing that all the new values (thefields without "_old" appended) are coming into the function as NULL.The old values are coming in properly, but the new values are justnull... Any ideas why this is happening? It''s actually getting into thefunction, so I''m guessing it has something to do with the way thegridview is setup... I can''t seem to find anything on this on google,or maybe I''m just not sure what to look for... Thanks in advance for any help,Mike 解决方案 这篇关于ASP.NET 2.0 ObjectDataSource UpdateMethod未传递新值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-03 00:17