In some cases, when referring to objects in the database, you must precede the name with the owner name - e.g. "objectowner.NumgenCreateS
Main Topics
Browse All TopicsHi,
Sorry, I'm a DB newbie and this probably has a simple answer, but given that it's the week after Christmas there's no one anywhere to be found around here and the MSSQL docs aren't much help so far.
Also, the app I'm using works on other people's systems fine, so I think this is something not configured right on my system-- I just don't know what to check. I'm using VC++ 6.0 and ADO 1.5...
The connection to the DB and the creation of the recordset instance succeed, but the first "Open()" call (doing just a SELECT) fails with an "Invalid object name" COM error. The table and column in the query exist, and I made sure the case of both were correct, and the permissions seem to be correct, but I'm not sure.
I'm hoping someone can just give me a specific lead to check. It's pretty urgent, so I'm assigning the max points. Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks for the ideas.
esmoreno, the table/object is owned by "dbo" so I assume it was created by "dbo"?
Scott, I tried Query Analyzer using the same login (my own username/domain) as from VC, and got essentially the same result:
Query: "SELECT * FROM NumgenCreateStatus ORDER BY ProdRun DESC"
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'NumgenCreateStatus'.
As you can see it's a very simple query as well. In Query Analyzer, I can see NumgenCreateStatus as a User Table, and can expand it, etc. Here's a question. I only have the DB set up as a System DSN, not a User DSN. But so do other people, for whom this all works. Should that matter at all?
Thanks for the help.
jgsrikanth, good thing to check. My connection string is "Data Source=SecretNumbers" which is also the DB listed in the ODBC Data Source Administrator / System DSN tab as a System Data Source.
But in Query Analyzer (and Enterprise Manager), the DB is not bumpy case-- it's "secretnumbers". The .MDF file in the SQL Server data area is "SecretNumbers.mdf" however. Does any of this matter?
Scott, the query you provided comes back empty:
name xtype owner id owner name
--------------------------
(0 row(s) affected)
I guess I'm really confused. If it doesn't exist, then why does QA list it as a User Table?
Scott, that second query came back empty as well:
name xtype owner id owner name
--------------------------
(0 row(s) affected)
About to try all lower case on the DB name, everywhere.
Thanks everyone.
Scott, good point-- I made sure the userid included the domain (because that is how the app logs onto the DB), and using Enterprise Mgr I looked at my user under enabled everything I could for that user, but I still got the same result.
jgsrikanth, the output from that query tells me I have a case-insensitive install (thanks for that tidbit):
Latin1-General, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive for Unicode Data, SQL Server Sort Order 52 on Code Page 1252 for non-Unicode Data
-------------
OK, first stupid thing... in QA I "Changed Database..." to NumgenCreateStatus, and then the query in question worked! But why won't the application work? What steps does it need to perform in addition to the following?
class CNumgenApp : public CWinApp
{
public:
.
.
CString m_connection;
// ADO
_ConnectionPtr m_pConnection;
.
.
}
.
.
BOOL CNumgenApp::InitInstance()
{
.
.
m_connection = "Data Source=secretnumbers";
.
.
try
{
m_pConnection.CreateInstan
m_pConnection->ConnectionT
m_pConnection->CommandTime
m_pConnection->Open(m_conn
pRecordset.CreateInstance(
pRecordset->CursorLocation
// THIS CALL FAILS
pRecordset->Open((const _variant_t)"SELECT * FROM NumgenCreateStatus ORDER BY ProdRun DESC",
m_pConnection.GetInterface
adOpenDynamic,
adLockOptimistic,
adCmdText);
.
.
}
.
.
}
Business Accounts
Answer for Membership
by: TruthHunterPosted on 2004-12-29 at 09:06:16ID: 12920227
Here's the actual COM error text returned:
BC SQL Server Driver][SQL Server]Invalid object name 'NumgenCreateStatus'..
Error:80040e37
ErrorMessage:IDispatch error #3127
Source:Microsoft OLE DB Provider for ODBC Drivers.
Description:[Microsoft][OD
FWIW I believe this is MSSQL Server 2000 (version is 8.00.534 SP2)