当前位置:首页 > 网络编程 > WEB编程 > ASP.net > 获得存储过程返回值的方法(return的值)

获得存储过程返回值的方法(return的值)

点击次数:25 次 发布日期:2008-11-27 01:22:07 作者:源代码网
源代码网推荐 获得存储过程的返回值


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());  //输出存储过程



源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华