J
Joe Cool
I am working on an app where I work that makes a connection to two
different databases. These databases may or may not reside on the same
server. One database is "our" database in that our suite of software
operates on the data in it. The other database is maintained by a
piece of third party software. My app only needs to pull data from it.
On one form in the app, there are two dropdowns. One to select whch
server the third party database resides on and the second to select
which database on that server is the third party database.
I populate the server dropdown with the SqlDataSourceEnumeration
class.
When the user then selects a server, the databases dropdown is
populated. The SqlDataSourceEnumeration does not require a separate
connection object but I am using the SqlConnection.GetSchema method to
obtain the list of databases, and it obviously needs a SqlConnection.
Since every other connection to the third part database is using ODBC,
I wanted to convert the populating of the databases dropdown to use
ODBC also, especially since the OdbcConnection class also supports a
GetSchema method.
But when I converted to ODBC (and yes, I modified the connection
appropriately), I get a permission error when trying to invoke the
GetSchema method.
Both connection strings specify to use a Trusted Connection.
So why can the Sql connection get the data and the Odbc connection
can't?
different databases. These databases may or may not reside on the same
server. One database is "our" database in that our suite of software
operates on the data in it. The other database is maintained by a
piece of third party software. My app only needs to pull data from it.
On one form in the app, there are two dropdowns. One to select whch
server the third party database resides on and the second to select
which database on that server is the third party database.
I populate the server dropdown with the SqlDataSourceEnumeration
class.
When the user then selects a server, the databases dropdown is
populated. The SqlDataSourceEnumeration does not require a separate
connection object but I am using the SqlConnection.GetSchema method to
obtain the list of databases, and it obviously needs a SqlConnection.
Since every other connection to the third part database is using ODBC,
I wanted to convert the populating of the databases dropdown to use
ODBC also, especially since the OdbcConnection class also supports a
GetSchema method.
But when I converted to ODBC (and yes, I modified the connection
appropriately), I get a permission error when trying to invoke the
GetSchema method.
Both connection strings specify to use a Trusted Connection.
So why can the Sql connection get the data and the Odbc connection
can't?