首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

select top 一 id from title order by id desc

2011-12-20 
select top 1 id from title order by id descC#中如何将上面select top 1 id from title order by id des

select top 1 id from title order by id desc
C#中如何将上面select top 1 id from title order by id desc这句的ID值传给一个变量,如TID

[解决办法]
select top 1 id as TId from title order by id desc
[解决办法]
变量是存储过程中的如:

declare @tid int 
select top 1 @tid =id from title order by id desc 


变量是C#程序中的:


sqlconnection conn=new sqlconnection(连接字符串);
sqlcommand cmd=new sqlcommand("select top 1 id from title order by id desc",conn);
int tid=convert.ToInt32(cmd.ExecuteScalar());



热点排行