C# and ms sql存储过程问问题
//string StfId = Request.QueryString.GetValues( "StfId ").GetValue(0).ToString();
//string QbNumber = Request.QueryString.GetValues( "QbNumber ").GetValue(0).ToString();
//string Money = Request.QueryString.GetValues( "Money ").GetValue(0).ToString();
//以上为取值,现在测试直接用
string StfId = "12 ";
string QbNumber = "2222222 ";
string Money = "5 ";
SqlConnection Conn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings.Get( "DataConnectionString "));
Conn.Open();
SqlCommand CmdUpdate = new SqlCommand( "Pro_QbType ", Conn);
CmdUpdate.CommandType = CommandType.StoredProcedure;
CmdUpdate.Parameters.Add( "@StfId ", SqlDbType.VarChar,4).Value = StfId;
CmdUpdate.Parameters.Add( "@QBValues ",SqlDbType.VarChar,4).Value = Money;
//建立并添加和“@QBcode OUTPUT”对应的参数
SqlParameter parmReturnValue = new SqlParameter( "@QBcode ", SqlDbType.VarChar,20);
//parmReturnValue.IsNullable = true;
parmReturnValue.Direction = ParameterDirection.Output;
CmdUpdate.Parameters.Add(parmReturnValue);
CmdUpdate.ExecuteNonQuery();
QBcode = CmdUpdate.Parameters[ "@QBcode "].Value.ToString();
SqlTransaction Trans = Conn.BeginTransaction();
try
{
CmdUpdate.Transaction = Trans;
CmdUpdate.ExecuteNonQuery();
QBcode =CmdUpdate.Parameters[ "@QBcode "].Value.ToString();
Trans.Commit();
CmdUpdate.Dispose();
Conn.Close();
}
catch (Exception Err)