DbCommand command = database.GetStoredProcCommand(spName); database.AddOutParameter(command, "@MessageDeliveryDocumentId", DbType.Int32, 0); database.AddInParameter(command, "@MessageDeliveryId", DbType.Int32, messageDeliveryId); database.AddInParameter(command, "@Attachment", DbType.Binary, attachment); database.AddInParameter(command, "@FileName", DbType.String, fileName); database.AddInParameter(command, "@FileType", DbType.String, fileType);