ASP.NET 编译与未编译数据库限定符
我们有一个使用 SQL 语句的 ASP.NET 应用程序,其中表名是不合格的。编译时,它工作正常,但未编译时,它会抱怨并出错,说这些表不存在。
(限定名称类似于 Select * from MyDatabase.mySchema.MyTable
;
不限定名称类似于 Select * from MyTable
)
如果您自己在数据库上尝试这些查询,则需要仅限定名称。
这是怎么回事?我认为编译与未编译的应用程序应该以相同的方式执行代码。
We have an ASP.NET application that uses SQL statements, where table names are unqualified. When compiled, it works fine, but when uncompiled, it complains and errors out, saying these tables dont' exist.
(Qualified name looks like Select * from MyDatabase.mySchema.MyTable
;
Unqualified like Select * from MyTable
)
If you try these queries on the database, by yourself, it will take only the qualified names.
What's going on? I thought Compiled vs Uncompiled apps should perform the same way codewise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里的“编译”到底是什么意思?
我认为你遇到的问题并不像你想象的那样。听起来更像是一个安全上下文问题,其中在一种情况下执行查询的用户上下文默认将查询传递给 myschema,而另一种情况则默认传递给 dbo。
What exactly do you mean by "Compiled" here?
I don't think the problem you are having is what you think it is. Sounds more like a security context issue where the user context you are executing the queries under in one case defaults to passing queries to myschema and the other defaults to dbo.
应用程序的行为是相同的,我的猜测是您正在谈论在 Cassini 中运行和在 IIS 中运行之间的区别?
如果是这种情况,请确保您的连接字符串是特定身份,而不是冒充调用者......
The applications will behave the same, my guess is that you are talking about the difference between running in Cassini and running in IIS?
If that is the case, be sure that your connection string is a specific identity, and not impersonating the caller...