ODP.net + VB = 未找到表
我是 Oracle 新手,刚刚安装了 Oracle 10g XE 及其适用于 .NET 的 ODAC 包。 我正在 VB 中制作一个简单的连接和获取表应用程序,但是,它总是抛出“找不到表”错误。
我在 Oracle Home(Web 管理工具)中创建了“测试”表,这是我在 VB 中使用的代码:
Dim oraCmd As New OracleCommand("Select * From Test")
oraCmd.Connection = oraCon
oraCon.Open()
oraCmd.ExecuteReader()
'Reader code supressed
编辑 当我在数据库主页中尝试相同的查询时,它有效。
I am new to Oracle and I have just installed Oracle 10g XE,and its ODAC package for .NET.
I am making a simple connect-and-get-table app in VB,however,it always throws a "Table not found" error.
I created the "Test" table in Oracle Home (the web admin thing) and here is the code I'm using in VB :
Dim oraCmd As New OracleCommand("Select * From Test")
oraCmd.Connection = oraCon
oraCon.Open()
oraCmd.ExecuteReader()
'Reader code supressed
EDIT When I try the same query in Database Home, it works.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在 Oracle 中使用不同的用户登录,并且想要从不同用户下的表中读取数据,则应该完全限定您的表名。如果您的表是在名为“TEST_USER”的用户下创建的,则将您的表查询为“Select * From TEST_USER.test”
当使用创建表的相同用户名登录时,这对我有用:
另一个可能的问题是您用小写字母将表命名为“Test”,而不是在数据库中将其命名为“TEST”。在这种情况下,您需要引用带有引号的表,如下所示:
或者,如果大小写是问题并且您想以这种方式解决它,您也可以在 Oracle 中重命名表:
If you're logging in using a different user in oracle, and want to read from a table under a different user, you should fully qualify your table name. If your table is created under a user named "TEST_USER", then query your table as "Select * From TEST_USER.test"
This works for me when logged in under the same username of which the table was created:
The other possible issue is that you named your table with lowercase letters as "Test", instead of it being named "TEST" in the database. In that case, you'll need to reference the table with quotes around it as such:
Or you could also, rename your table in oracle if case is the issue and you want to resolve it this way: