错误在3层体系结构中添加对业务访问层的引用 [英] error adding reference to business acess layer in 3-tier architecture

查看:72
本文介绍了错误在3层体系结构中添加对业务访问层的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。

im使用c#在asp.net中使用3层架构。

DAL.cs中的代码如下:

hi.
i m working on 3 tier architecture in asp.net using c#.
the code in DAL.cs is as follows:

namespace DataLayer
{
    public class DAL
    {
         string ConnectionString = ConfigurationManager.AppSettings["constr"].ToString();
        
        public string InsertUserInformation(BEL objBELUserDetails)
        {
            SqlConnection con = new SqlConnection(ConnectionString);
            con.Open();
            SqlCommand cmd = new SqlCommand("sp_userinformation", con);
            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.AddWithValue("@Empno", objBELUserDetails.UserName);
                cmd.Parameters.AddWithValue("@EmpName", objBELUserDetails.Password);
                cmd.Parameters.AddWithValue("@Salary", objBELUserDetails.FirstName);
                cmd.Parameters.AddWithValue("@Age", objBELUserDetails.LastName);
                cmd.Parameters.AddWithValue("@City", objBELUserDetails.Email);
                cmd.Parameters.AddWithValue("@Sr_no", objBELUserDetails.Phoneno);
                cmd.Parameters.AddWithValue("@event", objBELUserDetails.Location);
                cmd.ExecuteNonQuery();
                con.Close();
                cmd.Dispose();
                con.Close();
                con.Dispose();
            }
        }
      
        
    }




the

public string InsertUserInformation(BEL objBELUserDetails)

'BEL'显示无法找到类型或命名空间的错误,当我尝试添加参考时,它显示错误无法添加对BusinessLayer的引用添加此项目作为参考会导致循环依赖为什么?问题是什么?

' BEL ' shows error that the type or namespace could not be found and when i try to add refrence it shows error that "A reference to BusinessLayer could not be added adding this project as a reference would cause a circular dependency" Why? what is the problem?

推荐答案

WhatEver属性在你的业务层声明

同样你可以写入数据访问层

和来自业务层的u可以设置值到数据访问层的属性

无需添加参考
WhatEver Properties Declare in ur business layer
same thing u can write in data access layer
and from business layer u can set value to properties of data access layer
no need of adding refrence


这篇关于错误在3层体系结构中添加对业务访问层的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆