dongtrien 13 Newbie Poster

Suppose I create an asp.net website project that loads data into griview from the class library, declaring the library to use loading data for griview

//file: ChitietSP.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Diagnostics;               // Debug
using connectSQL;                            // warning

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
        } 
    }

    string sSQL;
   private void LoadData()
    {        
        sSQL = "SELECT * FROM TABKHACHHANG ";
        sSQL += "ORDER BY MASOPHIEU;";       

        GridView1.DataSource = ClsConnecSQL.FillDatatable(sSQL); //warning
    }

}

//file: clsConnecSQL.cs

using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//using connectSQL;

namespace connectSQL 
{
    public class ClsConnecSQL
    {
        public static DataTable FillDatatable(string sSQL)
        {
           //Do somthing...
        }
    }

}

I have declared the library namespace to be used is still error, asking you to help me
using connectSQL; // warning
GridView1.DataSource = ClsConnecSQL.FillDatatable (sSQL); // error not found connectSQL namespace

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.