Invalid object name?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 24
Joined: Thu 11 Nov 2004 12:59

Invalid object name?

Post by feamster » Tue 07 Feb 2006 15:00

I just upgraded my packages to 3.7. I'm using D2005 update 3 and trying to play with SQL2005. I duplicated my library on the SQL2005 and confirmed that using old programs with the new libraries work fine. Simple little programs. One MSConnection and one MSTable.

So I go to make a new program. One MSConnection and one MSTable.

Same info in the old and new program. The connection goes active just fine. The table won't. I get "invalid object name price". Price is the table name. Same as in the working program.

So I load the old working program and drop a new mstable component on it and point to the original connection component and it opens the table just fine. I drop a new msconnection component on the form and point this new table to it and I get Invalid object name price when I try to open it. I confirm that the connections have the exact same parameters. I look in the DFM and make sure everything is the same. It is.

This happens when I point to my SQL2005 and SQL2000 servers.

You have entered the twilight zone!


Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 08 Feb 2006 10:07

MSDN says: "In SQL Server 2000, database users and schemas are implicitly connected. Every database user is the owner of a schema that has the same name as the user. In SQL Server 2005, schemas exist independently of the database user that creates them". That is why you have to explicitly specify schema name in TableName property if you use SQL Server 2005. For example, rather than "price" you specify "john.price" where "john" is schema name in which table "price" was created.

Posts: 24
Joined: Thu 11 Nov 2004 12:59

So where do I specify the schema in your components?

Post by feamster » Wed 08 Feb 2006 14:15

I'm talking about 2 components on a form program. The program created with the old version (3.55) works fine. In the old program I point to the SQL2005 server and recompile and it works great. In a new program I do this:

File->New->Win32 forms application

1) Plop down a new MSConnection component on a form
Point to the correct server, library
Give it the correct userid and password
Set it active
OK, so far

2) Plop down a new mstable component
choose Price from the drop down table
(Where do I select or specify a schema?)
Try to make the table active
Boom! Invalid object name

Don't see anywhere to specify a schema in your components. The old program using this table in SQL2005 works fine. Just was thinking maybe some default in your new version components have changed.
internal default may have changed or something. I mean it is a new version of the components (3.7) so a bug isn't impossible, right?

Posts: 24
Joined: Thu 11 Nov 2004 12:59

Post by feamster » Wed 08 Feb 2006 20:10

OK. The sql2005 client wasn't installed on the test computer. So Invalid Object Name while trying to use the components is a problem but the program using straightforward SQL (not retrieving field names and such) seemed to work OK. I'll have to refine the circumstances that an extra client is required.


Post Reply