Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi
I have create a website and i have create two folders one is BAL(Business access layer) and other one is DAL(Data access layer)
In BAL i have created this code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
    public class Employees
    {
        public Employees()
        { }
        public int ID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Address { get; set; }
        public string Number { get; set; }
    }
and i have create class in DAL and i am trying to create below code in DAL
problem is that Employees class is not accessing and also list<> not accessing here
i don't know why it is happening can any one help me please
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
/// <summary>
/// Summary description for insert_customer
/// </summary>
public class insert_customer
{
	public insert_customer()
	{}
    public List<employees> insert_emp(Employees emp)
    {
        
    }
}

problem is that Employees class is not accessing and also list<> not accessing here
i don't know why it is happening can any one help me please
Posted 4-Oct-12 20:33pm
Edited 4-Oct-12 20:38pm
JF201553.1K
v2
Comments
Simon_Whale at 5-Oct-12 7:26am
   
is there a specific error message?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

u should add name space in DAL .
  Permalink  
Comments
Khdua Bux Baloch at 5-Oct-12 2:55am
   
hi dear i have added namespace in this way
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace mynamespce
{
public class Employees
{
public Employees()
{ }
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Address { get; set; }
public string Number { get; set; }
}
}
 
but namespace is not showing when i am calling can u help me please
itskvini at 5-Oct-12 3:02am
   
use
using yourNameSpanceName in insert_customer class.
solanki.net at 5-Oct-12 4:15am
   
U should add name space like that
 

using BL;
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Friend, create both the classes in the same namespace, will resolve your issue.
 
Thanks,
Ambesha
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi,
 
Write your code like below
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DAL;
 
namespace BAL
{
    public class Employees
    {
        public Employees()
        { }
        public int ID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Address { get; set; }
        public string Number { get; set; }
    }
}
 
And then write your DAL code as below
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BAL;
 
namespace DAL
{
/// <summary>
/// Summary description for insert_customer
/// </summary>
public class insert_customer
{
    public insert_customer()
    {}
    public List<Employees> insert_emp(Employees emp)
    {
 
    }
}
}
 

One more thing you should take care that both BAL and DAL folder are in same project.
If you have created BAL and DAL as different project then you need to add reference of the project as well to access the class from other project.
 
Hope this will help you.
  Permalink  
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100