Exemplo n.º 1
0
        public void ExecuteInsertParamters(string script, List <MySqlParameter> parameters)
        {
            SunConnection   Storeconn  = new SunConnection();
            MySqlConnection connection = Storeconn.Create();

            try
            {
                MySqlCommand command = connection.CreateCommand();
                command.CommandTimeout = 20;

                command.CommandText = script;

                if (parameters != null)
                {
                    foreach (MySqlParameter param in parameters)
                    {
                        command.Parameters.Add(param);
                    }
                }


                command.ExecuteNonQuery();
            }
            finally
            {
                connection.Close();
            }
        }
Exemplo n.º 2
0
        public int ExecuteInsertInt(string script, List <MySqlParameter> parameters)
        {
            SunConnection   Storeconn  = new SunConnection();
            MySqlConnection connection = Storeconn.Create();

            MySqlCommand command = connection.CreateCommand();

            command.CommandTimeout = 20;

            command.CommandText = script;

            if (parameters != null)
            {
                foreach (MySqlParameter param in parameters)
                {
                    command.Parameters.Add(param);
                }
            }


            command.ExecuteNonQuery();
            connection.Close();



            int id = Convert.ToInt32(command.LastInsertedId);

            return(id);
        }
Exemplo n.º 3
0
        public MySqlDataReader ExecuteSelect(string script)
        {
            SunConnection   StoreConn  = new SunConnection();
            MySqlConnection connection = StoreConn.Create();
            MySqlCommand    command    = connection.CreateCommand();

            command.CommandTimeout = 20;

            command.CommandText = script;

            MySqlDataReader reader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

            return(reader);
        }
Exemplo n.º 4
0
        public void ExecuteInsert(string script)
        {
            SunConnection   Storeconn  = new SunConnection();
            MySqlConnection connection = Storeconn.Create();

            try
            {
                MySqlCommand command = connection.CreateCommand();
                command.CommandTimeout = 20;

                command.CommandText = script;

                command.ExecuteNonQuery();
            }
            finally
            {
                connection.Close();
            }
        }
Exemplo n.º 5
0
        public MySqlDataReader ExecuteSelectParamters(string script, List <MySqlParameter> parameters)
        {
            SunConnection   StoreConn  = new SunConnection();
            MySqlConnection connection = StoreConn.Create();
            MySqlCommand    command    = connection.CreateCommand();

            command.CommandTimeout = 20;

            command.CommandText = script;

            if (parameters != null)
            {
                foreach (MySqlParameter param in parameters)
                {
                    command.Parameters.Add(param);
                }
            }

            MySqlDataReader reader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

            return(reader);
        }