更改 CommandText 会更改参数

发布于 2024-09-19 08:28:29 字数 321 浏览 5 评论 0原文

我正在尝试在 vb.net 设计器的 TableAdapter 中编辑插入命令的 CommandText。每当我对 CommandText 进行更改时,Visual Studio (2008) 都会自动将参数更改为一个集合,其中包含编辑命令之前存在的一个参数,沉浸在一堆完整的垃圾参数中,然后我要么必须撤消(除非这是我尝试编辑的第一件事,在这种情况下,我必须关闭设计器以放弃更改并重新打开它)或手动将所有参数更改回不完全垃圾的内容。

有没有人见过这样的事情,或者知道如何阻止 Visual Studio 谋杀我精心照料的参数?任何改变 CommandText 而无需找到另一个理由来咒骂 M$ 的方法将不胜感激。

I'm trying to edit the CommandText for the Insert Command in a TableAdapter in the Designer in vb.net. Whenever I make changes to the CommandText, Visual Studio (2008) automagically changes the Parameters to a Collection consisting of one Parameter that existed before editing the Command, immersed in a sea of complete garbage Parameters, and then I either have to undo (unless this was the first thing I tried editing, in which case I have to close the Designer to discard changes and reopen it) or manually change ALL the Parameters back to something that isn't complete garbage.

Has anybody seen anything like this, or know how to stop Visual Studio from murdering my carefully tended Parameters? Any way to change the CommandText without finding yet another reason to curse the name of M$ would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

箜明 2024-09-26 08:28:29

老实说,从 VB6 开始我就对内置设计器产生了疑问。其一,他们的行为很有趣,就像你的情况一样。此外,它们还将易于阅读的代码隐藏在“点击式”向导中。我建议只在代码中创建 ADO.NET 对象。您将完全控制代码,并避免 MS 开发人员对用户应在向导中获得的内容进行解释。

Honestly, I have taken issue with the built-in designers since VB6. For one, they behave funny, like your situation. Also, they hide what should be easily readable code inside the "point-n-click" wizards. I'd suggest just create the ADO.NET objects in code. You'll have full control over the code and avoid a MS developer's interpretation of what a user should get in a wizard.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文