ODP.Net和Designer生成的代码 [英] ODP.Net and Designer-generated code

查看:81
本文介绍了ODP.Net和Designer生成的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


对不起,如果这是一个错误的论坛:我没有找到任何关于ASP.NET开发的论坛。


我正在将旧的ASP.Net 1.1 / 2.0应用程序从Microsoft Data Provider for Oracle迁移到ODP.NET,并且已经遇到因不正确的参数绑定而停止工作的SQL语句。虽然我理解我需要做的关于
手动编写的代码,但是当涉及到Visual Studio生成的代码时,我完全迷失了。 * .ascx.cs文件中有很多声明,例如: < span style ="color:#0000ff; font-size:small">



protected OracleCommand oracleSelectComman d1;



protected OracleCommand oracleInsertCommand1;



protected OracleCommand oracleUpdateCommand1;



protected OracleCommand oracleDeleteCommand1;



等  稍后在这些文件的InitializeComponent()方法中使用,这些方法被注释为" Designer支持所需的
方法 - 不要修改 使用代码编辑器的方法的内容。"



当我打开相应的* .ascx文件时,我看不到那些OracleCommand对象,所以我没有线索基于生成此代码的内容,这些OracleCommand对象使用的SQL语句来自何处,以及如何定义它们的参数。
那么,有人可以给我一些关于如何生成此代码的指示,大多数重要的是,我如何更改所有这些自动生成的OracleCommand对象的BindByName属性,以便在重新生成代码时,更改将保持
或确保参数的添加顺序与SQL语句中出现的顺序相同?


BTW,这样的声明和InitializeComponent()方法可以在几个没有任何关联的* .ascx或* .aspx文件的纯* .cs文件中找到,这使得他们更令人费解......


最好的问候,

Konstantin



解决方案

您好Konstanin,


欢迎来到MSDN论坛。


对于ASP.NET开发问题,请重定向到这个适当的论坛:  https://forums.asp.net/ 寻求更好的支持,谢谢您的理解。


如果您将来有任何关于VS IDE的问题,请随时告诉我们。



祝你好运,


Sara


Hello,

Sorry if this is a wrong forum: I did not find any forum about ASP.NET development.

I'm migrating a legacy ASP.Net 1.1/2.0 application from Microsoft Data Provider for Oracle to ODP.NET and have already encountered SQL statements that stopped working because of incorrect parameter binding. While I understand what I need to do about manually written code, I'm completely lost when it comes to code generated by Visual Studio. There is a lot of declarations in *.ascx.cs files like:

protected OracleCommandoracleSelectCommand1;

protected OracleCommandoracleInsertCommand1;

protected OracleCommandoracleUpdateCommand1;

protected OracleCommandoracleDeleteCommand1;

etc.  that are later used in InitializeComponent() methods in these files, which are commented as "Required method for Designer support - do not modifythe contents of this method with the code editor."

When I open the corresponding *.ascx files, I see no mentioning of those OracleCommand objects, so I have no clue based on what this code was generated, where the SQL statements used by those OracleCommand objects come from, and how their arguments are defined. So, could someone please give me some pointers as to how this code is generated and, most importantly, how I can change the BindByName property of all those auto-generated OracleCommand objects so that if the code gets regenerated the change will remain or ensure that Parameters are added in the same order as they appear in the SQL statements?

BTW, such declarations and InitializeComponent() methods can be found in a couple of pure *.cs files that do not have any associated *.ascx or *.aspx files, which makes them even more puzzling...

Best regards,
Konstantin

解决方案

Hi Konstanin,

Welcome to the MSDN forum.

For the ASP.NET development issues, please redirect to this appropriate forum: https://forums.asp.net/ to seek for a better support, thank you for your understanding.

If you have any other issues about the VS IDE in the future, please feel free to let us know.

Best regards,

Sara


这篇关于ODP.Net和Designer生成的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆