Reputation: 5563
In VS2005, I am using a DLL which accesses a SQL Server. The DLL returns a SQLException
Invalid object name 'tableXYZ'
but tableXYZ is a table in the database.
Should it be looking for dbo.tableXYZ instead? Is this a permissions issue with the login being used?
Upvotes: 2
Views: 4170
Reputation: 12015
As a starting point, you could turn on an SQL Server Profiler trace, to see how the DLL is connecting to the database. e.g. you should be able to see what credentials are being used. You could also confirm to make sure the code is connecting to the right database etc.
Upvotes: 0
Reputation: 754518
Using dbo.tableXYZ
makes it clearer what you want - the tableXYZ
in the default dbo
schema. There could be a tableXYZ
in another schema, too - then SQL Server might not know which one you want.
And it could most definitely be a permissions issue. If you connect to that database in SQL SErver Mgmt Studio as that user - can you see that tableXYZ
table??
UPDATE: does the DLL require a specific connection string, that you might not have copied into your calling app's app.config file?? DLL's in .NET can't really have their own mylibrary.dll.config - it will not be read by .NET by default.
Upvotes: 1
Reputation: 43984
This could be an issue with the owner of the tableand permissions.
for example the table owner may be dbo
so the full table name will be dbo.TableXYZ
The user you connect as, could be for example SQLUser
may not have access to the dbo
schema. So can only access tables such as SQLuser.TableXYZ
I'd check the permissions that you use to connect to the database.
Upvotes: 1