-
March 16th, 2019, 02:41 AM
#1
namespace error when using namespaces that don't match namespace ?
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
Code:
//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
}
}
Code:
//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
Last edited by 2kaud; March 16th, 2019 at 06:08 AM.
Reason: Added code tags
-
March 16th, 2019, 05:53 AM
#2
Re: namespace error when using namespaces that don't match namespace ?
Is clsConnecSQL.cs included as a file in your project? In other words, is it getting built?
-
March 22nd, 2019, 09:24 PM
#3
Re: namespace error when using namespaces that don't match namespace ?
I send the error example to you, you can see and fix the error for me, you can see the attached file
http://www.mediafire.com/file/iiak7w...p_net.rar/file
-
March 22nd, 2019, 11:34 PM
#4
Re: namespace error when using namespaces that don't match namespace ?
Originally Posted by dongtrien
Please attach the file directly if you would like us to look at it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|