html5中文学习网

您的位置: 首页 > 网络编程 > ASP.NET » 正文

获得存储过程返回值的方法(return的值)_.NET教程_编程技术

[ ] 已经帮助:人解决问题
存储过程
获得存储过程的返回值


System.Data.SqlClient.SqlConnection scon = new System.Data.SqlClient.SqlConnection("server=Netangel;uid=etopsUS;pwd=etops;database=etops");
System.Data.SqlClient.SqlCommand scom = new System.Data.SqlClient.SqlCommand("",scon);

scon.Open();
scom.CommandText="p_CorpClassAdd";
scom.CommandType = System.Data.CommandType.StoredProcedure;
scom.Parameters.Add(
                new SqlParameter("ReturnValue", SqlDbType.Int, 4,
                ParameterDirection.ReturnValue, false, 0, 0,
                string.Empty, DataRowVersion.Default, null)) //增加存储过程的返回值参数

            

scom.ExecuteNonQuery();
Response.Write(scom.Parameters["ReturnValue"].Value.ToString());  //输出存储过程的返回值 
HfDHTML5中文学习网 - HTML5先行者学习网
HfDHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助