若有以下代码操作存储过程:
   SqlCommand borrowbook=new SqlCommand();
   borrowbook.Connection=this.sqlConnection1;
   borrowbook.CommandType=CommandType.StoredProcedure;
   borrowbook.CommandText="dbo.StoredProcedureBookNumber";
   SqlParameter parinput=borrowbook.Parameters.Add("@BookID",SqlDbType.Char);
   parinput.Direction=ParameterDirection.Input;
   parinput.Value=BookID;
   SqlParameter paroutput=borrowbook.Parameters.Add("@BookNumber",SqlDbType.Int);
   paroutput.Direction=ParameterDirection.Output;
   try
   {
    this.sqlConnection1.Open();   
    borrowbook.ExecuteNonQuery();
    this.sqlConnection1.Close();
                if ( paroutput.Value!=DBNull.Value )
                    return Convert.ToInt16(paroutput.Value);
                else
                    return -1;

    
   }
   catch(System.Exception e)
   {
    this.ErrorHandle(e);    
    this.sqlConnection1.Close();
    return 0;

   }

相关文章:

  • 2021-09-11
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
相关资源
相似解决方案