vpa — 2012-04-09T12:59:11-04:00 — #1
I'm hoping someone can help me out on this one. I'm trying to import a dummy list of employees from my database via visual web developer and I think the code is right but everytime I run the page I get a 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: CS0234: The type or namespace name 'sqlClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
Line 1: <%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk.master" %>
Line 2: <%@ Import Namespace = "System.Data.sqlClient" %>
Line 3: <script runat="server">
This is the code I have
<%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk.master" %>
<%@ Import Namespace = "System.Data.sqlClient" %>
protected void Page_Load(object sender, EventArgs e)
sqlConnection conn = new sqlConnection(
"Database=helpdesk;User ID=helpdesk;" +
sqlCommand comm = new sqlCommand(
"SELECT EmployeeID, Name FROM Employees", conn);
sqlDataReader reader = conn.ExecuteReader();
employeesLabel.Text += reader["Name"] + "<br />";
Can someone advice me on what I have done wrong and how to fix it?
imaginekitty — 2012-04-09T21:50:10-04:00 — #2
It's case sensitive. Try <%@ Import Namespace = "System.Data.SqlClient" %>
kittydance — 2012-04-17T22:27:44-04:00 — #3
I think imaginekitty is right. It has to be System.Data.SqlClient. Also make sure you have the System.Data.dll in the correct location.
wwb_99 — 2012-04-18T14:18:44-04:00 — #4
System.Data.dll should be living in the GAC, it is part of the base class library.
mittineague — 2014-09-17T23:15:36-04:00 — #5
This topic is now archived. It is frozen and cannot be changed in any way.