当 SQL 中的表尚不存在时强制 CREATE PROC (VB.NET)
我正在将很多项目从 VB6 转换为 VB.NET。其中许多项目都使用 DAO 方法 CreateQueryDef,而 ADO.NET 则没有。我知道有一种方法可以使用目录在 ADOX 中复制此方法,但我想继续使用纯 ADO.NET。我一直在使用 CREATE PROC 来执行此操作,但 VB6 版本中的一些查询定义提到了直到稍后才创建的表/查询。例如,
CreateQueryDef(a, "SELECT ... FROM b")
...
CreateQueryDef(b, "SELECT ...")
项目的方式,不可能简单地翻转这两条线。我想知道是否有办法强制 CREATE PROC a AS SELECT ... FROM b
即使 b 尚不存在,或者 ADO.NET 中是否有不同的选项来复制 CreateQueryDef功能。
谢谢!
I am converting a lot of projects from VB6 to VB.NET. Many of these projects use the DAO method CreateQueryDef, something ADO.NET does not. I know there is a way to replicate this method in ADOX using Catalogs, but I wanted to stay with pure ADO.NET. I have been using CREATE PROC to do this, but some of the query def's in the VB6 version mention tables/queries that are not created until later. For example,
CreateQueryDef(a, "SELECT ... FROM b")
...
CreateQueryDef(b, "SELECT ...")
The way the projects are, it is not possible to simply flip these two lines. I was wondering if there is a way to force CREATE PROC a AS SELECT ... FROM b
even though b does not exist yet, or if there is a different option in ADO.NET to replicate the CreateQueryDef functionality.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MS SQL Server 允许您定义使用尚未创建的表的过程。只要在执行过程时它们存在,它就可以工作。
MS SQL Server allows you to define procedures that use tables that have not yet been created. As long as they are present when the procedure is executed, it works.