Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
C#
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
C#
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
Updated 4-Oct-12 20:38pm
v2
Comments
Simon_Whale 5-Oct-12 7:26am    
is there a specific error message?

u should add name space in DAL .
 
Share this answer
 
Comments
Khudha Bakhsh Mari 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 5-Oct-12 3:02am    
use
using yourNameSpanceName in insert_customer class.
solanki.net 5-Oct-12 4:15am    
U should add name space like that


using BL;
Friend, create both the classes in the same namespace, will resolve your issue.

Thanks,
Ambesha
 
Share this answer
 
v2
Hi,

Write your code like below

C#
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

XML
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.
 
Share this answer
 
v3

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900