Importing sql client namespace

Hi guys,

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?)

Source Error:



Line 1:  <%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk.master" %>
Line 2:  <%@ Import Namespace = "System.Data.sqlClient" %>
Line 3:  <script runat="server">
Line 4:


This is the code I have

<%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk.master" %>
<%@ Import Namespace = "System.Data.sqlClient" %>
<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        sqlConnection conn = new sqlConnection(
            "Server=localhost\\\\sqlExpress;Database=helpdesk;" +
            "Database=helpdesk;User ID=helpdesk;" +
            "Password=helpdesk");
        sqlCommand comm = new sqlCommand(
            "SELECT EmployeeID, Name FROM Employees", conn);
        conn.Open();
        sqlDataReader reader = conn.ExecuteReader();
        while (reader.Read())
        {
            employeesLabel.Text += reader["Name"] + "<br />";
        }
        reader.Close();
        conn.close();
    }
</script>

Can someone advice me on what I have done wrong and how to fix it?

Thank You

It’s case sensitive. Try <%@ Import Namespace = “System.Data.SqlClient” %>

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.

System.Data.dll should be living in the GAC, it is part of the base class library.