c#和数据库问题

来源:百度知道 编辑:UC知道 时间:2024/05/27 18:56:37
111111111111111111111111132133333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
c# 怎么接收到 数据库 存储过程返回的字符串

麻烦大家了.
先给5分意思这 看回答加亮

//这是存储过程
CREATE PROCEDURE delArticle @articleid int,@neirong varchar(150) output?

AS set @neirong = (select neirong from db_Article where articleid=@articleid
delete from db_Article where articleid=@articleid
GO

C# 调用

SqlCommand1=new SqlCommand("delArticle",SqlConnection1);
SqlCommand1.CommandType=CommandType.StoredProcedure;
SqlCommand1.Parameters.Add(new SqlParameter("@articleid",SqlDbType.int));
SqlCommand1.Parameters["@articleid"].Value = MyDataGrid.DataKeys[e.Item.ItemIndex];
SqlCommand1.Parameters.Add( new SqlParameter("@neirong",SqlDbType.VarChar,150));
SqlCommand1.Parameters["@neirong"].Value = "";
SqlCommand1.Parameters["@neirong"].Direction= ParameterDirection.Output;

SqlConnection1.Open();
int r=SqlCommand1.ExecuteNonQuery();

//返回值

string neirong= SqlCommand1.Parameters["@neirong&qu