如何列出具有 DSN 连接的数据库的视图?
首先,我想向您展示我正在处理的代码(VB6):
Dim db as Connection
Dim rs as Recordset
Dim rs1 as Recordset
db.Open "DSN=myDSN; Uid=myUser; Pwd=myPassword;"
'I connect successfully
Set rs = db.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "TABLE"))
' Everything ok here. I can list Database tables
Set rs1 = db.OpenSchema(adSchemaViews) 'This is the line I have problems with
当我尝试列出数据库的视图时,我收到一条错误消息: “El Proedor no puede ejecutar la operaciòn requerida”(“提供商无法执行所需的操作”)
我配置了一个可以使用密码访问 BD 的用户。当我使用连接字符串连接到相同的数据库时,我可以列出 Oracle 和 SqlServer 中的表和视图。
我错过了什么吗?数据库引擎中的配置选项。或许?
First, I want to show you the code I'm working on (VB6):
Dim db as Connection
Dim rs as Recordset
Dim rs1 as Recordset
db.Open "DSN=myDSN; Uid=myUser; Pwd=myPassword;"
'I connect successfully
Set rs = db.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "TABLE"))
' Everything ok here. I can list Database tables
Set rs1 = db.OpenSchema(adSchemaViews) 'This is the line I have problems with
when I try to list the Database's views I got an error that says:
"El proveedor no puede ejecutar la operaciòn requerida" ("Provider can't execute the required operation")
I configured an user that can access the BD it with a password. When I connect to the same Databases using a connection string I can list both tables and views in both Oracle and SqlServer.
Am I missing something? A configuration option in the databases Engines. maybe?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了!从 DSN 连接来看,视图和表都被视为表。
这是有效的代码:
我希望这可以帮助别人。
感谢您的阅读!
I Found it! From a DSN connection, both Views and Tables are considerer as Tables.
This is the code that works:
I hope this can help somebody.
Thanks for reading!