Ejemplo n.º 1
0
 public void on()
 {
     this.connection = SQLjec.getInstance().conn();
     this.cmd        = this.connection.CreateCommand();
     this.connection.Open();
 }
Ejemplo n.º 2
0
        public void sql_update(bool ex)
        {
            bool flag = !ex;

            if (flag)
            {
                this.connection = SQLjec.getInstance().conn();
                this.cmd        = this.connection.CreateCommand();
                this.connection.Open();
            }
            string text  = "";
            string text2 = "";
            byte   b     = 0;

            foreach (string[] current in this.values)
            {
                text = string.Concat(new string[]
                {
                    text,
                    current[0],
                    "='",
                    current[1],
                    "'"
                });
                b += 1;
                bool flag2 = (int)b < this.values.Count;
                if (flag2)
                {
                    text += ",";
                }
            }
            byte b2 = 0;

            foreach (string[] current2 in this.values2)
            {
                text2 = string.Concat(new string[]
                {
                    text2,
                    current2[0],
                    "='",
                    current2[1],
                    "'"
                });
                b2 += 1;
                bool flag3 = (int)b2 < this.values2.Count;
                if (flag3)
                {
                    text2 += " and ";
                }
            }
            this.cmd.CommandText = string.Concat(new string[]
            {
                "update ",
                this._table,
                " set ",
                text,
                " where ",
                text2
            });
            this.cmd.CommandType = CommandType.Text;
            this.cmd.ExecuteNonQuery();
            bool flag4 = !ex;

            if (flag4)
            {
                this.connection.Close();
            }
            else
            {
                this.values.Clear();
                this.values2.Clear();
            }
        }