我在SQL Server中创建了一个View(dbo.ViewMySQL
),现在想从MS Access中使用ADO查询它,连接字符串如下所示:
cs = "Driver={SQL Server};"
cs = cs & "Server=IP,port;"
cs = cs & "Database=database_name;"
con.Open cs, "user", "password"
我尝试了以下SQL语句:
strQry = "select * from dbo_ViewMySQL"
strQry = "select * from viewMySQL"
strQry = "select * from [dbo].[viewMySQL]"
strQry = "select * from [db-name].[dbo].[viewMySQL]"
错误消息显示对象名称无效
Laufzeitffehler'-2147217865(80040e37)':[Microsoft] [ODBC SQL Server 驱动程序] [SQL Server]UngültigerObjektname'dbo_ViewMySQL'
对于strQry = "select * from tbl_Test"
和其他表格,但不适用于视图,为什么会这样?
谢谢