Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am getting an "invalid object" warning error in the Management Studio query. Any query against the table works and it links correctly to another table. I am investigating an error that I'm getting in C#. See: http://stackoverflow.com/questions/14409788/is-not-a-foreign-key-column-and-cannot-be-used-here This is the latest attempt to ferret out what may be going wrong. My linq queries against this table fail, but when I go to classic ADO.NET using SQL strings they work perfectly. Is it possible that this "invalid object" is causing C#/linq to kill the connection?
How do I get the table to stop the "invalid object" error. There are two tables, the following is the simplest one:

USE [Report]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tblHoliDate](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Holiday] [date] NOT NULL,
    [Description] [varchar](50) NOT NULL,
    [DOW] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

It is nothing more than a table of holidays used to calculate the business days between two dates.
edit
Any reference to the table will do (which is why I didn't add a query).

SELECT * FROM tblHoliDate

Mouse over the table name to see the error.
The exact error is "invalid object name tblHolidate". This only occurs on mouse-over and the results of any SQL query against the table are complete and correct.

share|improve this question
2  
My guess? You're in the context of the wrong database. Regardless, run a SQL Trace or XE session and see what exactly is happening on the database. Then you'll have your answer. –  Thomas Stringer Jan 24 '13 at 19:15
2  
Without seeing the exact error text, I can only think of a few things it could be: 1) the object actually doesn't exist 2) wrong database 3) the current principle doesn't have permissions on the object. –  Thomas Stringer Jan 24 '13 at 19:37
1  
The warning on mouse over should be from the auto complete feature, it's my guess. Try refreshing the cache for Intellisense in Management Studio. –  Marian Jan 24 '13 at 20:27
1  
@ThomasStringer: they're pretty unrelated, as I guess. OP just wanted to verify a hunch (where warning of non existing table might be somehow related to an error he gets using LINQ, but not in normal SQL or ADO). –  Marian Jan 24 '13 at 22:03
1  
@Marian Oh absolutely, I couldn't agree more. A classic case of IntelliSense not refreshing wouldn't cause that error when running a query. –  Thomas Stringer Jan 24 '13 at 22:06
show 7 more comments

1 Answer

up vote 1 down vote accepted

The warning on mouse over should be from the auto complete feature, it's my guess. I've met that a few times. Especially with newly created tables in a session. Try refreshing the cache for Intellisense in Management Studio and this should fix it.

share|improve this answer
    
This, unfortunately, did not fix my original problem which has to do with accessing this table using linq. :( –  Dave Jan 24 '13 at 21:07
    
These are unrelated issues, I'm afraid. This one is a Management Studio warning, that one is an application error. –  Marian Jan 24 '13 at 21:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.