asp.net dataset问题
SqlCommandcmd=connection.CreateCommand();cmd.CommandText="selectIndexIdas用户ID,LoginNa...
SqlCommand cmd = connection.CreateCommand();
cmd.CommandText = "select IndexId as 用户ID,LoginName as 用户名,RealName as 姓名,Password as 密码,Department as 部门,Telephone as 电话,MobilePhone as 手机,Email as 邮箱,UserKind as 权限 from T_UserInfo";
SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
dataAdapter.Fill(ds,"UserInfo");
要把ds中权限这一列的数字改为中文(例如:1改为管理员)怎么办? 展开
cmd.CommandText = "select IndexId as 用户ID,LoginName as 用户名,RealName as 姓名,Password as 密码,Department as 部门,Telephone as 电话,MobilePhone as 手机,Email as 邮箱,UserKind as 权限 from T_UserInfo";
SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
dataAdapter.Fill(ds,"UserInfo");
要把ds中权限这一列的数字改为中文(例如:1改为管理员)怎么办? 展开
3个回答
展开全部
cmd.CommandText = "select IndexId as 用户ID,LoginName as 用户名,RealName as 姓名,Password as 密码,Department as 部门,Telephone as 电话,MobilePhone as 手机,Email as 邮箱,case UserKind when 1 then '管理员' else UserKind end as 权限 from T_UserInfo";
展开全部
直接用sql语句中改吧
(case when UserKind=1 then '管理员' else '普通用户' end )
as 权限
这样就行了
(case when UserKind=1 then '管理员' else '普通用户' end )
as 权限
这样就行了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
也可以
权限=case when UserKind=1 then '管理员' else '普通用户' end
权限=case when UserKind=1 then '管理员' else '普通用户' end
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询