Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / July 2008

Tip: Looking for answers? Try searching our database.

are you missing a using directive or an assembly reference

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
m.a - 31 Jul 2008 17:38 GMT
Hello,

 I have the following code which is an entity for a table in my database.
but I am getting several errors such as:

The type or namespace name 'ColumnAttribute' could not be found (are you
missing a using directive or an assembly reference?)

Using the generic type 'System.Data.Linq.Table<TEntity>' requires '1' type
arguments

What is the problem and how can I solve it?

Regards

[Table(Name = "Items")]

public class Items

{

[Column(IsPrimaryKey = true)]

public int Title { get; set; }

[Column]

public string Desc { get; set; }

}
Ignacio Machin ( .NET/ C# MVP ) - 31 Jul 2008 18:43 GMT
> Hello,
>
[quoted text clipped - 28 lines]
>
> - Show quoted text -

The [Column] attribute is not being found, are you using the correct
include  directive?
Peter Duniho - 31 Jul 2008 18:47 GMT
> [...]
> The type or namespace name 'ColumnAttribute' could not be found (are you
[quoted text clipped - 5 lines]
>
> What is the problem and how can I solve it?

No doubt, the errors are correct.  The first one is very clear about how  
to fix it: you are missing either a using directive or assembly reference  
(or possibly both).

Without a concise-but-complete code sample, it's not possible to comment  
on whether you're missing the using directive.  And you'll have to check  
yourself to make sure the project includes the necessary reference to the  
System.Data.Linq assembly.

Note that this is from LINQ and so you have to be using .NET 3.5.

My guess is that if you resolve the first error, that will address the  
second as well.

Pete

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.