Click here to Skip to main content
15,891,019 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The type or namespace name 'DataClasses1DataContext' could not be found (are you missing a using directive or an assembly reference?)

am getting this error for the below code
C#
{
DataClasses1DataContext _context = new DataClasses1DataContext();
        
        var dateTime = DateTime.Now.ToString();
        var events = from a in _context.riya()
                    select a;
}


why this error arising?
Posted
Updated 7-Feb-12 22:10pm
v2
Comments
CRDave1988 8-Feb-12 4:12am    
what is DataClasses1DataContext?
r u using LINQ?
idhris2011 8-Feb-12 4:23am    
s...am using linq

This is not a class supplied with .NET. This is probably the auto-generated class you borrowed from some code or development walk-through article, like this one:

http://www.devx.com/dotnet/Article/36714/1954[^].

If it exists in some article, it does not mean it should exist in your code you are trying to compile at this moment. Anyway, in your C# code there is nothing which mystically appears as a result of activity or different Designers or Wizards. Everything is declared and can be found in code. If not, it won't compile. As simple as that.

That said: you are doing something wrong in principle. You should not follow any kinds of instruction like a blind-folded one. I would advise you do everything with you own hands and only if your perfectly understand every line you right. When you are comfortable with that, all kinds of tool can assist you sometimes. Not sooner.

—SA
 
Share this answer
 
Comments
Espen Harlinn 8-Feb-12 9:13am    
Good reply :)
Sergey Alexandrovich Kryukov 8-Feb-12 10:26am    
Thank you, Espen.
--SA
In which assembly "DataClasses1DataContext" exists?

I guess, you haven't added the reference of assembly in which DataClasses1DataContext exists.
Add reference of same assembly and try again

Hope this might help you...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900