久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

NET中三層構(gòu)架開發(fā)實例-用戶注冊系統(tǒng)

 liuqg 2006-03-06
下面是用戶注冊系統(tǒng)開發(fā)的三層構(gòu)架實例:數(shù)據(jù)庫基類采用上面提供的代碼。

1、用戶注冊模塊數(shù)據(jù)層開發(fā):
using System;
using System.Data;
using System.Data.SqlClient;
using HaiSky.HtJob;
using System.Xml;
namespace HaiSky.HtJob.Accounts.AccountsData
{
    public class User : HaiSky.HtJob.HaiSkyDbObject
    {
        public User(string newConnectionString) : base(newConnectionString)
        {//直接路由連接字符串}
        public int Create(string user_nm,string user_pwd)
        {
            int rowsAffected;
            SqlParameter[] parameters = {new SqlParameter("@user_nm",SqlDbType.Char,16),
                                        new
SqlParameter("@user_pwd",SqlDbType.Char,16)};
            parameters[0].Value = user_nm;
            parameters[1].Value = user_pwd;
            parameters[2].Direction = ParameterDirection.Output;
            try
            {
                RunProcedure("IF_user_info",parameters,out rowsAffected);
            }
            catch
            {    }
            return (int)parameters[2].Value;
        }
    }
}

2,、用戶注冊商務(wù)層開發(fā):
using System;
using System.Configuration;
using HaiSky.HtJob.Accounts.AccountsData;
namespace HaiSky.HtJob.Accounts.AccountBusiness
{
    public class User : HaiSky.HtJob.HaiSkyBizObject
    {
        int userID;
        string userName;
        string userPwd;
        string strConn;
        public User()
        {
            strConn = ConfigurationSettings.AppSettings["strConn"];
        }
        public int Careate()
        {
            AccountsData.User dataUser = new AccountsData.User(strConn);
            userID = dataUser.Create(userName,userPwd);
            return userID;
        }
        public int UserID
        {
            get
            {
                return userID;
            }
            set
            {
                userID = value;
            }
        }
        public string UserName
        {
            get
            {
                return userName;
            }
            set
            {
                userName = value;
            }
        }
        public string UserPwd
        {
            get
            {
                return userPwd;
            }
            set
            {
                userPwd = value;
            }
        }
    }
}

3、 用戶注冊表示層開發(fā):
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using HaiSky.HtJob.Accounts.AccountBusiness;

namespace HaiSky.HtJob.Modules.Accounts
{
    public class Register : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.TextBox TextBox1;
        protected System.Web.UI.WebControls.TextBox TextBox2;
        protected System.Web.UI.WebControls.Table Table1;
        protected System.Web.UI.WebControls.Button Button1;

        private void Page_Load(object sender, System.EventArgs e)
        {
            Table1.Rows[0].Cells[0].Visible = false;
        }
        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }    
        private void InitializeComponent()
        {    
            this.Button1.Click += new System.EventHandler(this.Button1_Click);
            this.Load += new System.EventHandler(this.Page_Load);
        }
        #endregion
        private void Button1_Click(object sender, System.EventArgs e)
        {
            int i;
            HtJob.Accounts.AccountBusiness.User BusinessUser = new HtJob.Accounts.AccountBusiness.User();
            BusinessUser.UserName = TextBox1.Text;
            BusinessUser.UserPwd = TextBox2.Text;
            i = BusinessUser.Careate();
            Response.Write (i.ToString());                         //這里輸出返回值
        }
    }
}

4,、該系統(tǒng)調(diào)用的存儲過程:
CREATE PROCEDURE IF_user_info
(@user_nm char(16),@user_pwd char(16),@user_ID int output)
AS
    insert user_info(user_nm,user_pwd) values(@user_nm,@user_pwd)
set @user_ID = @@identity
    IF @@ERROR > 0
        BEGIN
        RAISERROR (‘Insert of Article failed‘, 16, 1)

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點,。請注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多