String sql = "moveData";
mCMD = DB.GetStoredProcCommand(sql);
DB.AddInParameter(mCMD,"@State",DbType.Int32,2);
DB.AddParameter(mCMD, "@ret", DbType.Byte, ParameterDirection.ReturnValue,"",DataRowVersion.Default,null);
mCMD.Parameters["@ret"].Value
1.添加參數
public void AddParameter(DbCommand command, string name, DbType dbType, ParameterDirection direction, string sourceColumn, DataRowVersion sourceVersion, object value);
DB.AddParameter(mCMD, "@return", DbType.Byte, ParameterDirection.ReturnValue,"",DataRowVersion.Default,null);
DB.AddParameter(mCMD, "@return", DbType.Byte, ParameterDirection.ReturnValue,NULL,DataRowVersion.Default,null);
說明:第二個為參數名必須為 @變數名 否則系統會自動添加
ParameterDirection.ReturnValue 最關鍵指明去傳回值
2.執行
DB.ExecuteNonQuery(mCMD);
3.取值
DbType.Byte x= mCMD.Parameters["@return"].Value;
轉自:http://www.cnblogs.com/zfh424/archive/2009/02/03/1383507.html