如何调试3层应用程序? [英] how to debug a 3-tier application?

查看:77
本文介绍了如何调试3层应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表示层;

Presentation layer;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using DAL;

namespace _3_tiersample
{
    public partial class RegistrationForm : System.Web.UI.Page
    {
        classDAL Objdal = new classDAL();
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                string Output = string.Empty;
                classBLL Objbalregistration = new classBLL();
                Objbalregistration.Name = TextBox1.Text;
                Objbalregistration.Roll_Number = Convert.ToInt32(TextBox2.Text);
                Objbalregistration.Email_Id = TextBox3.Text;
                Objbalregistration.Mobile_Number = TextBox4.Text;
                Objdal.InsertUserDetails(Objbalregistration); 
                Console.WriteLine("Data Inserted");
            }
            catch(Exception Ex)
            {
                Console.WriteLine(Ex);
            }
        }

    }
}



数据访问层


Data access layer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using BLL;

namespace DAL
{
    public class classDAL
    {
        string connection = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
     
        public void InsertUserDetails(classBLL Objbal)
      {
          SqlConnection con = new SqlConnection(connection);
          SqlCommand cmd = new SqlCommand("sp_InsertEmpdetails", con);
          cmd.CommandType = CommandType.StoredProcedure;
          con.Open();
          try
          {
              cmd.Parameters.AddWithValue("@Name", Objbal.Name);
              cmd.Parameters.AddWithValue("@Roll_Number", Objbal.Roll_Number);
              cmd.Parameters.AddWithValue("@Email_Id", Objbal.Email_Id);
              cmd.Parameters.AddWithValue("@Mobile_Number", Objbal.Mobile_Number);
              Console.WriteLine( "data saved");
          }
          catch (Exception Ex)
          {
              Console.WriteLine(Ex);
          }
          finally
          {
              con.Dispose();
          }

      }
       
    }  
}



业务逻辑层


Business Logic Layer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;


namespace BLL
{
    public class classBLL
    {
        private string _Name;
        private int _Roll_Number;
        private string _Email_Id;
        public string _Mobile_Number;


        public string Name
        {
            set { _Name = value; }
            get { return _Name; }
        }
        public int Roll_Number
        {
            set { _Roll_Number = value; }
            get { return _Roll_Number; }
        }
        public string Email_Id
        {
            set { _Email_Id = value; }
            get { return _Email_Id; }
        }
        public string Mobile_Number
        {
            set { _Mobile_Number = value; }
            get { return _Mobile_Number; }
        }

    }
}



当我运行我的应用程序时,我只获得表示层执行。但是什么都没有工作我需要做什么才能使它工作?

提前感谢


when i running my application i'am getting only presentation layer executed.but nothing is working what i need to do to make it work?
thanks in advance

推荐答案

在每一层中放置断点并调试它按F11 ..
put breakpoints in each layer and debug it with pressing F11..


您可以使用F11键导航到应用程序中的不同层,或者您也可以在业务层或数据层方法中添加断点,以将调试选项带到特定方法。
you can use F11 key to navigate to different layer in the application or you can also add break point in your business layer or datalayer methods to take debug option to particular method.


Objdal.InsertUserDetails(Objbalregistration);







在调试时按fll




press fll while debugging


这篇关于如何调试3层应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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