110,539
社区成员
发帖
与我相关
我的任务
分享
create procedure [dbo].[getFriendList]
@my INT OUTPUT,
@friendid INT output,
AS
select @friendid=my
from FriendInfo
where MyID=@MyQQID
declare @n nvarchar(4000)
select @n=''
select @n=@n+','+cast(MyID AS varchar(10)) from FriendInfo where FriendID=100001
select @n=@n+','+cast(FriendID AS varchar(10)) from FriendInfo where MyID=100001
select @friendid=@n
/* 准备演示过程 getFriendList,
* CREATE PROCEDURE [dbo].[getFriendList]
AS
select 1
UNION ALL
SELECT 2
UNION ALL
SELECT 3
*/
//....
public DataTable Execute()
{
DataTable dt = new DataTable();
SqlConnection conn=new SqlConnection();
SqlCommand cmd = new SqlCommand("getFriendList", conn);
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
dt.Load(cmd.ExecuteReader());
conn.Close();
return dt;
}