Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I configured a simple ASP.NET website on Windows Server 2008 R2 in IIS7 and everything goes well, but now when I want it to use database for showing information, I get this error in Internet Explorer:
Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0246: The type or namespace name 'DataClassesDataContext' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

 

Line 10:     protected void Page_Load(object sender, EventArgs e)
Line 11:     {
Line 12:         DataClassesDataContext db = new DataClassesDataContext();
Line 13:         var q = from i in db.Table1s
Line 14:                 select i;

Source File: c:\inetpub\oranges\sub\Default.aspx.cs    Line: 12 

The Line 12 appears in Red!

I used LINQ in Visual Studio 2010 and here is my code:
C#
DataClassesDataContext db = new DataClassesDataContext();
var q = from i in db.Table1s
        select i;
foreach (var i in q)
    ListBox1.Items.Add(i.data);

What is the problem?
And is that neccessary to install SQLExpress in a server?

Thanks in advance.
Posted

1 solution

Well i guess you first start reading some elementary books regarding database. Then follow below link to start doing some experimentation.

Working With Data (Beginners Guide to Database in ASP.NET Web Pages Part 1)[^]
 
Share this answer
 
Comments
salehne 4-Feb-15 6:55am    
Thanks, but I don't have any problem with database in ASP.NET.
This is the first time that I want to publish my simple website on a local server. Even my simple website works on IIS7.5 in Windows7, but doesn't work on Windows Server 2008 R2 and that's my problem.
Thank's again.

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