在C#中怎么调用存储过程的返回值 SELECT [ErrorDescribe]=N'抱歉地通知您,您所输入的帐号名含有限制字符串,请更换帐号名后再次申请帐号!'RETURN 4上面这个是存储过程里的返回值,怎么在C#程序中返回这个4呢怎么在程序里输出呢。帮帮忙,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 returnvalueoutputSqlConnection conn = ""; conn.Open(); SqlCommand MyCommand = new SqlCommand("", conn); MyCommand.CommandType = CommandType.StoredProcedure; MyCommand.Parameters.Add(new SqlParameter("@a", SqlDbType.Int)); MyCommand.Parameters["@a"].Value = 10; MyCommand.Parameters.Add(new SqlParameter("@b", SqlDbType.Int)); MyCommand.Parameters["@b"].Value = 20; MyCommand.Parameters.Add(new SqlParameter("@return", SqlDbType.Int)); MyCommand.Parameters["@return"].Direction = ParameterDirection.ReturnValue; MyCommand.ExecuteNonQuery(); Response.Write(MyCommand.Parameters["@return"].Value.ToString()); SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ToString()); conn.Open(); SqlCommand MyCommand = new SqlCommand("", conn); MyCommand.CommandType = CommandType.StoredProcedure; MyCommand.Parameters.Add(new SqlParameter("@a", SqlDbType.Int)); MyCommand.Parameters["@a"].Value = 20; MyCommand.Parameters.Add(new SqlParameter("@b", SqlDbType.Int)); MyCommand.Parameters["@b"].Value = 20; MyCommand.Parameters.Add(new SqlParameter("@c", SqlDbType.Int)); MyCommand.Parameters["@c"].Direction = ParameterDirection.Output; MyCommand.ExecuteNonQuery(); Response.Write(MyCommand.Parameters["@c"].Value.ToString()); OracleParameter[] pParm = new OracleParameter[11]; //对日照分析,返回的字段有:工程名称,建设单位,链接 pParm[0] = new OracleParameter("tableName", OracleType.VarChar);//要查询的表的名称 pParm[0].Direction = ParameterDirection.Input; pParm[0].Value = "plan_rzfx_project"; pParm[1] = new OracleParameter("orderField", OracleType.VarChar); //以最终提交日期为排序关键词 pParm[1].Direction = ParameterDirection.Input; pParm[1].Value = "endTime"; pParm[2] = new OracleParameter("startNum", OracleType.Int16); //返回的起始记录数 pParm[2].Direction = ParameterDirection.Input; pParm[2].Value = netPager.StartRecordIndex; pParm[3] = new OracleParameter("entNum", OracleType.Int16);//返回的终止记录数 pParm[3].Direction = ParameterDirection.Input; pParm[3].Value = netPager.EndRecordIndex; pParm[4] = new OracleParameter("returnField1", OracleType.VarChar);//返回值字段1 pParm[4].Direction = ParameterDirection.Input; pParm[4].Value = "projectid"; pParm[5] = new OracleParameter("returnField2", OracleType.VarChar);//返回值字段2 pParm[5].Direction = ParameterDirection.Input; pParm[5].Value = "projectname"; pParm[6] = new OracleParameter("returnField3", OracleType.VarChar);//返回值字段3 pParm[6].Direction = ParameterDirection.Input; pParm[6].Value = "buildingcompany"; pParm[7] = new OracleParameter("returnField4", OracleType.VarChar);//返回值字段3 pParm[7].Direction = ParameterDirection.Input; pParm[7].Value = "linkref"; pParm[8] = new OracleParameter("returnField5", OracleType.VarChar);//返回值字段3 pParm[8].Direction = ParameterDirection.Input; pParm[8].Value = "filesnumber"; pParm[9] = new OracleParameter("records", OracleType.Cursor);//返回值的游标 pParm[9].Direction = ParameterDirection.Output; pParm[10] = new OracleParameter("resultCount", OracleType.Int16);///返回的总的记录数 pParm[10].Direction = ParameterDirection.Output; WPF中如何显示表格? windows server 2003 iis 6 中如何设置 ISAPI 和 CGI 限制 请对windbg比较熟悉的同志给我留个QQ号,我有些问题需要启蒙 C#登录淘宝 c#如何把byte数组转成short数组 c# DropDownList事件不能触发的问题 求一个正则表达式 大哥大姐们,帮帮小妹,急!!!! c#操作excel如何使用模板? 关于C#视频的问题?高手请进,大哥、大姐进来帮小弟看看呀?急呀???? 【讨论】.Net版本的远程桌面 交叉数组或者树的应用,比较难,想看看大家的解决方案
output
SqlConnection conn = "";
conn.Open();
SqlCommand MyCommand = new SqlCommand("", conn);
MyCommand.CommandType = CommandType.StoredProcedure;
MyCommand.Parameters.Add(new SqlParameter("@a", SqlDbType.Int));
MyCommand.Parameters["@a"].Value = 10;
MyCommand.Parameters.Add(new SqlParameter("@b", SqlDbType.Int));
MyCommand.Parameters["@b"].Value = 20;
MyCommand.Parameters.Add(new SqlParameter("@return", SqlDbType.Int));
MyCommand.Parameters["@return"].Direction = ParameterDirection.ReturnValue;
MyCommand.ExecuteNonQuery();
Response.Write(MyCommand.Parameters["@return"].Value.ToString());
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ToString());
conn.Open();
SqlCommand MyCommand = new SqlCommand("", conn);
MyCommand.CommandType = CommandType.StoredProcedure;
MyCommand.Parameters.Add(new SqlParameter("@a", SqlDbType.Int));
MyCommand.Parameters["@a"].Value = 20;
MyCommand.Parameters.Add(new SqlParameter("@b", SqlDbType.Int));
MyCommand.Parameters["@b"].Value = 20;
MyCommand.Parameters.Add(new SqlParameter("@c", SqlDbType.Int));
MyCommand.Parameters["@c"].Direction = ParameterDirection.Output;
MyCommand.ExecuteNonQuery();
Response.Write(MyCommand.Parameters["@c"].Value.ToString());
//对日照分析,返回的字段有:工程名称,建设单位,链接 pParm[0] = new OracleParameter("tableName", OracleType.VarChar);//要查询的表的名称
pParm[0].Direction = ParameterDirection.Input;
pParm[0].Value = "plan_rzfx_project"; pParm[1] = new OracleParameter("orderField", OracleType.VarChar); //以最终提交日期为排序关键词
pParm[1].Direction = ParameterDirection.Input;
pParm[1].Value = "endTime"; pParm[2] = new OracleParameter("startNum", OracleType.Int16); //返回的起始记录数
pParm[2].Direction = ParameterDirection.Input;
pParm[2].Value = netPager.StartRecordIndex; pParm[3] = new OracleParameter("entNum", OracleType.Int16);//返回的终止记录数
pParm[3].Direction = ParameterDirection.Input;
pParm[3].Value = netPager.EndRecordIndex; pParm[4] = new OracleParameter("returnField1", OracleType.VarChar);//返回值字段1
pParm[4].Direction = ParameterDirection.Input;
pParm[4].Value = "projectid"; pParm[5] = new OracleParameter("returnField2", OracleType.VarChar);//返回值字段2
pParm[5].Direction = ParameterDirection.Input;
pParm[5].Value = "projectname"; pParm[6] = new OracleParameter("returnField3", OracleType.VarChar);//返回值字段3
pParm[6].Direction = ParameterDirection.Input;
pParm[6].Value = "buildingcompany"; pParm[7] = new OracleParameter("returnField4", OracleType.VarChar);//返回值字段3
pParm[7].Direction = ParameterDirection.Input;
pParm[7].Value = "linkref"; pParm[8] = new OracleParameter("returnField5", OracleType.VarChar);//返回值字段3
pParm[8].Direction = ParameterDirection.Input;
pParm[8].Value = "filesnumber"; pParm[9] = new OracleParameter("records", OracleType.Cursor);//返回值的游标
pParm[9].Direction = ParameterDirection.Output; pParm[10] = new OracleParameter("resultCount", OracleType.Int16);///返回的总的记录数
pParm[10].Direction = ParameterDirection.Output;