declare @pid varchar(80)
declare @id bigint
select @id=case when max(convert(bigint,pers_id)) is null then 0 else max(convert(bigint,pers_id)) end +100000001 from tab_pers_info
set @pid=right(cast(@id as varchar(20)),8)以上是存储过程里的!但是我想把上面的语句转化为C#中的代码!希望高人指点!
declare @id bigint
select @id=case when max(convert(bigint,pers_id)) is null then 0 else max(convert(bigint,pers_id)) end +100000001 from tab_pers_info
set @pid=right(cast(@id as varchar(20)),8)以上是存储过程里的!但是我想把上面的语句转化为C#中的代码!希望高人指点!
解决方案 »
- asp.net中实现双击屏幕滚动效果?
- C#中怎样把本地的图片存进数据库中,再从数据库中取出在Image中显示呢????
- C# EXECL打印问题求助
- javascript 如何调用隐藏的listbox??
- 初学 SOCKET编程的一个问题
- 怎么取符合格式的日期
- DataGrid分页?????????在线等
- dataGrid打印问题。谢谢大家
- 如何手动添加DataGridViewRow到DataGridView
- 想做个同步的功能,即两表数据一致!
- 请大家帮个忙,在winform中运行程序之后,程序调用SQL语句取上datagrid上的值做insert操作,总是提示“该字符串之前有未闭合的引号”呢?
- 问个<c#高级编程>第三版的简单问题:绘制可滚动的窗体?
得到的查询结果返回值
比如说是
int aaa=0;
aaa=“得到的返回值”+100000001;
sqlConn.Open();
string sql="select case when max(convert(bigint,pers_id)) is null then 0 else max(convert(bigint,pers_id)) end +100000001 as id from pers_info_test";
SqlDataAdapter sqlDA = new SqlDataAdapter(sql, sqlConn);
DataSet DS = new DataSet();
sqlDA.Fill(DS,"abc");
string id = DS.Tables["abc"].Rows[0]["id"].ToString();
string pid = id.Substring(1, id.Length - 1);