SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2011
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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:

    PHP Code:
    DescriptionAn error occurred during the compilation of a resource required to service this requestPlease review the following specific error details and modify your source code appropriately

    Compiler Error MessageCS0234The 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
    PHP Code:
    <%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk.master" %>
    <%@ 
    Import Namespace = "System.Data.sqlClient" %>
    <
    script runat="server">

        protected 
    void Page_Load(object senderEventArgs 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

  2. #2
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    It's case sensitive. Try <%@ Import Namespace = "System.Data.SqlClient" %>

  3. #3
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    System.Data.dll should be living in the GAC, it is part of the base class library.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •