得到存储过程参数为output的参数值
2008-03-10 11:48
176 查看
public void bind()
{
SqlConnection con = new SqlConnection(strCon);
con.Open();
SqlCommand com = new SqlCommand();
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "系统管理.USP流水单号By生成";
com.Connection = con;
com.Parameters.Add("@流程编码", SqlDbType.VarChar, 7);
com.Parameters["@流程编码"].Value = "ZDL";
com.Parameters.Add("@新申请单号", SqlDbType.VarChar, 20);
com.Parameters["@新申请单号"].Direction = ParameterDirection.Output;
SqlDataReader dr = com.ExecuteReader();
//foreach(SqlParameter parmeter in com.Parameters)
//{
// Response.Write(string.Format("参数名:{0},参数方向:{1},参数值:{2}
", parmeter.ParameterName, parmeter.Direction.ToString(), parmeter.Value));
//}
for (int i = 0; i < com.Parameters.Count;i++ )
{
Response.Write(string.Format("参数名:{0},参数方向:{1},参数值:{2}
", com.Parameters[i].ParameterName, com.Parameters[i].Direction.ToString(), com.Parameters[i].Value));
}
}
//例子:
if (!Page.IsPostBack)
{
string 单号 = "1";
string 流程编码 = "SQ0607";
Get生成申请单号(流程编码, ref 单号);
}
#region 生成申请单号
/// <summary>
/// 自动生成申请单号
/// </summary>
/// <param name="pFirstCode">前缀代号 (内服药:NFFH 外用药:WYFH)</param>
/// <param name="pPosition">申请单号</param>
public void Get生成申请单号(string 流程编码, ref string 申请单号)
{
SqlConnection connection = new SqlConnection(strConnction);
connection.Open();
SqlCommand com = new SqlCommand();
com.Connection = connection;
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "系统管理.USP流水单号By生成";
com.Parameters.Add("@流程编码", SqlDbType.VarChar, 7);
com.Parameters.Add("@新申请单号", SqlDbType.VarChar, 20);
com.Parameters[0].Value = 流程编码;
com.Parameters[1].Direction = ParameterDirection.Output;
SqlDataReader datReader = com.ExecuteReader();
申请单号 = com.Parameters[1].Value.ToString();
}
#endregion
{
SqlConnection con = new SqlConnection(strCon);
con.Open();
SqlCommand com = new SqlCommand();
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "系统管理.USP流水单号By生成";
com.Connection = con;
com.Parameters.Add("@流程编码", SqlDbType.VarChar, 7);
com.Parameters["@流程编码"].Value = "ZDL";
com.Parameters.Add("@新申请单号", SqlDbType.VarChar, 20);
com.Parameters["@新申请单号"].Direction = ParameterDirection.Output;
SqlDataReader dr = com.ExecuteReader();
//foreach(SqlParameter parmeter in com.Parameters)
//{
// Response.Write(string.Format("参数名:{0},参数方向:{1},参数值:{2}
", parmeter.ParameterName, parmeter.Direction.ToString(), parmeter.Value));
//}
for (int i = 0; i < com.Parameters.Count;i++ )
{
Response.Write(string.Format("参数名:{0},参数方向:{1},参数值:{2}
", com.Parameters[i].ParameterName, com.Parameters[i].Direction.ToString(), com.Parameters[i].Value));
}
}
//例子:
if (!Page.IsPostBack)
{
string 单号 = "1";
string 流程编码 = "SQ0607";
Get生成申请单号(流程编码, ref 单号);
}
#region 生成申请单号
/// <summary>
/// 自动生成申请单号
/// </summary>
/// <param name="pFirstCode">前缀代号 (内服药:NFFH 外用药:WYFH)</param>
/// <param name="pPosition">申请单号</param>
public void Get生成申请单号(string 流程编码, ref string 申请单号)
{
SqlConnection connection = new SqlConnection(strConnction);
connection.Open();
SqlCommand com = new SqlCommand();
com.Connection = connection;
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "系统管理.USP流水单号By生成";
com.Parameters.Add("@流程编码", SqlDbType.VarChar, 7);
com.Parameters.Add("@新申请单号", SqlDbType.VarChar, 20);
com.Parameters[0].Value = 流程编码;
com.Parameters[1].Direction = ParameterDirection.Output;
SqlDataReader datReader = com.ExecuteReader();
申请单号 = com.Parameters[1].Value.ToString();
}
#endregion
相关文章推荐
- 关于ExecuteNonQuery执行存储过程的返回值 、、实例讲解存储过程的返回值与传出参数、、、C#获取存储过程的 Return返回值和Output输出参数值
- 根据存储过程的参数名得到存储过程的参数信息???????
- 得到存储过程的参数信息
- 存储过程output参数_数据库调用_C#_NET调用简单CODE
- 用exec调用带有output输出参数的存储过程
- C#获取存储过程的Return返回值和Output输出参数值
- SQLSERVER 存储过程调用存储过程,如何得到输出参数
- C#获取存储过程的 Return返回值和Output输出参数值
- C#获取存储过程的Return返回值和Output输出参数值
- PHP如何得到mssql的存储过程的输出参数?
- C#获取存储过程的Return返回值和Output输出参数值
- C#获取存储过程的Return返回值和Output输出参数值
- C#获取存储过程的Return返回值和Output输出参数值
- 从带输出参数的存储过程中获取输出参数的值 OUTPUT
- Entity Framework 执行存储过程的 获取 OutPut 参数的值
- PHP如何得到mssql的存储过程的输出参数?
- IBatis.Net如何获取存储过程的Output的参数值
- .net 存储过程中的 output参数取值问题
- Entity Framework如何获取存储过程中的output参数
- C#获取存储过程的Return返回值和Output输出参数值