Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
CSS
namespace BusinessAccessLayer
{
    public class logiclayer
    {
        String Admisson_Number, First_Name, Last_Name, Father_Name, Mother_Name, Caste, Occupation, Parent_Mobilenumber,
                  Village_Name, District_Name, Street_Name, House_Number, Photo_Path;
        DateTime Dateof_Birth, Dateof_Joining;
        int Branch_Id, Gender_Id, Section_Id, State_Id, Country_Id, Religion_Id, Yearsof_Course, Pincode, Academic_Year;

        logiclayer ObjDal = new logiclayer();

        public string PAdmission_Number
        {
            set { Admisson_Number = value; }
            get { return Admisson_Number; }
        }
        public string PFirst_Name
        {
            set { First_Name = value; }
            get { return First_Name; }
        }
        public string PLast_Name
        {
            set { Last_Name = value; }
            get { return Last_Name; }
        }
        public string PFather_Name
        {
            set { Father_Name = value; }
            get { return Father_Name; }
        }


namespace DataAccessLayer
{
public class ClsDalLayer
{
SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

ClsDalLayer Objdal = new ClsDalLayer();

public void DalRegistration()
{
SqlCommand Cmd = new SqlCommand("Sp_InsertStudentDetails", Con);
Cmd.Parameters.AddWithValue("@Admission_Number",Objdal.);// here i could not access the properties of the class logiclayer why?
how to write code to insert code into database Help me out
Thanks in advance
Posted

1 solution

You need to import the BusinessAccessLayer to access logiclayer class and also you need to create object for logiclayer class if you want to access that class properties.
here is the sample code..
using BusinessAccessLayer;
namespace DataAccessLayer
 {
 public class ClsDalLayer
 {
 SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
  
 logiclayer Objbal = new logiclayer();

 public void DalRegistration()
 {
try
{
 SqlCommand Cmd = new SqlCommand("Sp_InsertStudentDetails", Con);
 Cmd.Parameters.AddWithValue("@Admission_Number",Objbal.PAdmission_Number)
Cmd.Parameters.AddWithValue("@Admission_Number",Objbal.PFirst_Name)
Cmd.Parameters.AddWithValue("@Admission_Number",Objbal.PLast_Name)
Cmd.Parameters.AddWithValue("@Admission_Number",Objbal.PFather_Name)
Con.open();
Cmd.ExecuteNonQuery();

}
catch(Exception ex)
{
}
finally
{
Con.Close();
}
}
 
Share this answer
 
Comments
raxhemanth 20-Feb-14 12:12pm    
how to add bll reference to dll i could not have added the reference and the error iam getting is a reference to the business acvess layer could not be added adding this project as a reference would cause a circular dependency rrror help me out

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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