Emp id的自动生成代码 [英] auto generation code for Emp id

查看:136
本文介绍了Emp id的自动生成代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我在C#.net中自动生成Emp id代码。

我正在尝试编写代码,但是抛出新的NOTIMPLEMENTEDEXCEPTION();错误一次又一次地发生。

所以请帮助我摆脱它...

pls help me for the auto generation of Emp id code in C#.net.
i am trying to write the code but the "throw new NOTIMPLEMENTEDEXCEPTION();" error is occuring again and again.
so pls help me to get out of it...

推荐答案

// SP
ALTER PROCEDURE dbo.GetRowsCount
AS
	SET NOCOUNT ON;
	
	SELECT * FROM users
	
	RETURN




// DAL
  public int getRowsCount()
        {
            con.Open();

            SqlCommand cmd = new SqlCommand("GetRowsCount", con);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            da.Fill(dt);

            con.Close();

            return dt.Rows.Count;
        }




//BAL
public int RowCount()
        {
            return usr.getRowsCount();
        }




// while inserting data from UI
protected void btn_Click(object sender, EventArgs e)
       {

               bc.GetID = bc.RowCount() + 1;
       }


这篇关于Emp id的自动生成代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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