是否有人知道 C# 语言中如何获取 新用户注册的 id号, 这时 我用的是三层连接的数据库

[复制链接]
查看11 | 回复2 | 2011-6-21 12:41:48 | 显示全部楼层 |阅读模式
谢谢 急求!!!
求详解!谢谢!
public DataSet GetList(string strWhere)

{ StringBuilder strSql = new StringBuilder();

strSql.Append("select u_id,u_rollName,u_roll,u_userName,u_pwd,u_realName,u_company,u_post,u_mobile,u_telephone,u_mail,u_business,u_state,u_obligate1,u_obligate2,u_obligate3,u_lv,u_date,u_sn,u_country,u_city,u_sex ");

strSql.Append(" FROM rs_user ");

if (strWhere.Trim() != "")

{ strSql.Append(" where " + strWhere);

}return base.GetDataSet(strSql.ToString()); }

回复

使用道具 举报

千问 | 2011-6-21 12:41:48 | 显示全部楼层
你的新建用户的sql后面加一句select @@identity as NewID然后用reader读结果就能拿到最新插入的数据的ID了...
回复

使用道具 举报

千问 | 2011-6-21 12:41:48 | 显示全部楼层
select @@identity 就好了...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行