Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

i have 3 tier architecture - data access layer dll is not found

$
0
0

Dear all,

I have started working in my asp.net project - I am now getting dll not found error and build is unsuccessful. I am getting error as dataaccesslayer dll is not found. If this is not working properly - I may create on more library for dataaccesslayer.

This is the Employee class file sample

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace IFMR { public class EmployeeMaster { private int empCode; private string empName; private string pgCode; private DateTime dob; private string sex; private string martial; private DateTime doj; private string divCode; private string brnCode; private string dptCode; private string dsgCode; private string grdCode; private string empID; private string firstName; private string lastName; private string gender; private string location; private string photoPath; public int EmpCode { get { return empCode; } set { empCode = value; } } public string EmpName { get { return empName; } set { empName = value; } } public string PGCode { get { return pgCode; } set { pgCode = value; } } public DateTime Dob { get { return dob; } set { dob = value; } } public string Sex { get { return sex; } set { sex = value; } } public string Martial { get { return martial; } set { martial = value; } } public DateTime Doj { get { return doj; } set { doj = value; } } public string DivCode { get { return divCode; } set { divCode = value; } } public string BrnCode { get { return brnCode; } set { brnCode = value; } } public string DptCode { get { return dptCode; } set { dptCode = value; } } public string DsgCode { get { return dsgCode; } set { dsgCode = value; } } public string GrdCode { get { return grdCode; } set { grdCode = value; } } public string EmpID { get { return empID; } set { empID = value; } } public string FirstName { get { return firstName; } set { firstName = value; } } public string LastName { get { return lastName; } set { lastName = value; } } public string Gender { get { return gender; } set { gender = value; } } public string Location { get { return location; } set { location = value; } } public string PhotoPath { get { return photoPath; } set { photoPath = value; } } } }


This is front end code

using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DataAccessLayer; namespace cwdrweb { public partial class Welcome : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnViewEmployees_Click(object sender, EventArgs e) { grdViewEmployees.Visible = true; grdViewEmployees.DataSource = DataAccessLayer.EmpDataAccessLayer.GetAllEmployees(); grdViewEmployees.DataBind(); //string cs7 = ConfigurationManager.ConnectionStrings["SampleConnectionString"].ConnectionString; //using(SqlConnection con5 = new SqlConnection(cs7)) //{ // using(SqlCommand cmd6 = new SqlCommand("spGetAllEmployees",con5)) // { // con5.Open(); // grdViewEmployees.DataSource = cmd6.ExecuteReader(); // grdViewEmployees.DataBind(); // } //} } } }

Dataaccess layer - sample

using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using IFMR; namespace DataAccessLayer { public class EmpDataAccessLayer { public static List<EmployeeMaster> GetAllEmployees() { List<EmployeeMaster> listEmployeeMaster = new List<EmployeeMaster>(); //string cs9 = ConfigurationManager. string cs7 = ConfigurationManager.ConnectionStrings["SampleConnectionString"].ConnectionString; using (SqlConnection con = new SqlConnection()) { using (SqlCommand cmd8 = new SqlCommand("spGetAllEmployees", con)) { cmd8.CommandType = CommandType.StoredProcedure; con.Open(); SqlDataReader rdr = cmd8.ExecuteReader(); while (rdr.Read()) { EmployeeMaster employee = new EmployeeMaster(); employee.EmpID = rdr["EmpID"].ToString(); employee.FirstName = rdr["FirstName"].ToString(); employee.LastName = rdr["LastName"].ToString(); employee.Gender = rdr["Gender"].ToString(); employee.Location = rdr["Location"].ToString(); employee.PhotoPath = rdr["PhotoPath"].ToString(); listEmployeeMaster.Add(employee); } } } return listEmployeeMaster; } } }

I was getting initialling squiggly line in ConfigurationManager - namespace - inspite of adding - using statement System.Configuration.

in one of the blog they mentioned - you may have to reference manually as well.

C:\Windows\Microsoft.Net\Framework\V2.0.5.0727\System.Configuration.dll - whether my project (dataaccesslayer dll got corrupted)

Any inputs are welcome.

Warm Regards,

sathya




Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>