Exemple #1
0
        internal int Execute(IEnumerable <SqlParameter> parameters)
        {
            try
            {
                using (SqlCommand command = new SqlCommand())
                {
                    command.Parameters.AddRange(parameters.ToArray());
                    command.CommandText    = querybulder.GetCommandText();
                    command.CommandType    = CommandType;
                    command.Connection     = Connection;
                    command.CommandTimeout = CommandTimeout;
                    var count = command.ExecuteNonQuery();
                    return(count);
                }
            }

            catch (Exception ex)
            {
                MessageForError(ex.Message, "First try");
            }

            finally
            {
                Connection.Close();
            }

            return(-1);
        }