PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2005 namespace error when using namespaces that don't match namespace ?-VBForums
Results 1 to 4 of 4

Thread: namespace error when using namespaces that don't match namespace ?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    355

    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

    //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

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,389

    Re: namespace error when using namespaces that don't match namespace ?

    Firstly, please don't post unformatted code snippets.
    csharp Code:
    1. using System;
    2. using System.Data;
    3. using System.Configuration;
    4. using System.Collections;
    5. using System.Web;
    6. using System.Web.Security;
    7. using System.Web.UI;
    8. using System.Web.UI.WebControls;
    9. using System.Web.UI.WebControls.WebParts;
    10. using System.Web.UI.HtmlControls;
    11.  
    12. using System.Diagnostics;               // Debug
    13. using connectSQL;                            // warning
    14.  
    15. public partial class _Default : System.Web.UI.Page
    16. {
    17.     protected void Page_Load(object sender, EventArgs e)
    18.     {
    19.         if (!IsPostBack)
    20.         {
    21.             LoadData();
    22.         }
    23.     }
    24.  
    25.     string sSQL;
    26.    private void LoadData()
    27.     {        
    28.         sSQL = "SELECT * FROM TABKHACHHANG ";
    29.         sSQL += "ORDER BY MASOPHIEU;";      
    30.        
    31.         GridView1.DataSource = ClsConnecSQL.FillDatatable(sSQL); //warning
    32.     }
    33.    
    34. }
    csharp Code:
    1. using System.Configuration;
    2. using System.Collections;
    3. using System.Web;
    4. using System.Web.Security;
    5. using System.Web.UI;
    6. using System.Web.UI.WebControls;
    7. using System.Web.UI.WebControls.WebParts;
    8. using System.Web.UI.HtmlControls;
    9. //using connectSQL;
    10.  
    11. namespace connectSQL
    12. {
    13.     public class ClsConnecSQL
    14.     {
    15.         public static DataTable FillDatatable(string sSQL)
    16.         {
    17.            //Do somthing...
    18.         }
    19.     }
    20.    
    21. }
    csharp Code:
    1. using connectSQL; // warning
    2. GridView1.DataSource = ClsConnecSQL.FillDatatable (sSQL); // error not found connectSQL namespace
    Secondly, don't tell us that you receive a warning or an error without telling us what the message is. The message is what tells you what is wrong and thus how to fix it.

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,389

    Re: namespace error when using namespaces that don't match namespace ?

    Is this a web site or a web application project?

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    355

    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

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width