Пример #1
0
        private Int64 GetMachineId(SqlCommand command)
        {
            _dbObj.ResetCommand(command);
            command.CommandText = "Library.GetWorkstationId";
            command.CommandType = CommandType.StoredProcedure;

            //Add standard param(s)
            command.Parameters.Add("@WorkstationName", SqlDbType.VarChar).Value = Environment.MachineName;

            //Create the result parameter and add it to the command
            SqlParameter paramResultMachineId = new SqlParameter("@Result", SqlDbType.BigInt)
            {
                Direction = ParameterDirection.Output
            };

            command.Parameters.Add(paramResultMachineId);

            //Add error handling params
            _dbObj.AddErrorHandlingParamsToSqlCommand(command);

            command.ExecuteNonQuery();

            _dbObj.VerifyStoredProcedureResult(command);

            Int64 result = (Int64)paramResultMachineId.Value;

            return(result);
        }