Exemplo n.º 1
0
        public void sql_insert(bool ex)
        {
            bool flag = !ex;

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

            foreach (string[] current in this.values)
            {
                text += current[0];
                text2 = text2 + "'" + current[1] + "'";
                num  += 1;
                bool flag2 = (int)num < this.values.Count;
                if (flag2)
                {
                    text  += ",";
                    text2 += ",";
                }
            }
            this.cmd.CommandText = string.Concat(new string[]
            {
                "insert into ",
                this._table,
                " (",
                text,
                ") values (",
                text2,
                ")"
            });
            this.cmd.CommandType = CommandType.Text;
            this.cmd.ExecuteNonQuery();
            bool flag3 = !ex;

            if (flag3)
            {
                this.connection.Close();
            }
            else
            {
                this.values.Clear();
                this.values2.Clear();
            }
        }
Exemplo n.º 2
0
        public void sql_update(bool ex)
        {
            if (!ex)
            {
                this.connection = SQLjec.getInstance().conn();
                this.cmd        = this.connection.CreateCommand();
                this.connection.Open();
            }
            string str1 = "";
            string str2 = "";
            byte   num1 = (byte)0;

            foreach (string[] strArray in this.values)
            {
                str1 = str1 + strArray[0] + "='" + strArray[1] + "'";
                ++num1;
                if ((int)num1 < this.values.Count)
                {
                    str1 = str1 + ",";
                }
            }
            byte num2 = (byte)0;

            foreach (string[] strArray in this.values2)
            {
                str2 = str2 + strArray[0] + "='" + strArray[1] + "'";
                ++num2;
                if ((int)num2 < this.values2.Count)
                {
                    str2 = str2 + " and ";
                }
            }
            this.cmd.CommandText = "update " + this._table + " set " + str1 + " where " + str2;
            this.cmd.CommandType = CommandType.Text;
            this.cmd.ExecuteNonQuery();
            if (!ex)
            {
                this.connection.Close();
            }
            else
            {
                this.values.Clear();
                this.values2.Clear();
            }
        }
Exemplo n.º 3
0
        public void sql_delete(bool ex)
        {
            bool flag = !ex;

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

            foreach (string[] current in this.values2)
            {
                text = string.Concat(new string[]
                {
                    text,
                    current[0],
                    "='",
                    current[1],
                    "'"
                });
                num += 1;
                bool flag2 = (int)num < this.values2.Count;
                if (flag2)
                {
                    text += " and ";
                }
            }
            this.cmd.CommandText = "delete from " + this._table + " where " + text;
            this.cmd.CommandType = CommandType.Text;
            this.cmd.ExecuteNonQuery();
            bool flag3 = !ex;

            if (flag3)
            {
                this.connection.Close();
            }
            else
            {
                this.values.Clear();
                this.values2.Clear();
            }
        }
Exemplo n.º 4
0
        public void sql_insert(bool ex)
        {
            if (!ex)
            {
                this.connection = SQLjec.getInstance().conn();
                this.cmd        = this.connection.CreateCommand();
                this.connection.Open();
            }
            string str1 = "";
            string str2 = "";
            short  num  = (short)0;

            foreach (string[] strArray in this.values)
            {
                str1 = str1 + strArray[0];
                str2 = str2 + "'" + strArray[1] + "'";
                ++num;
                if ((int)num < this.values.Count)
                {
                    str1 = str1 + ",";
                    str2 = str2 + ",";
                }
            }
            this.cmd.CommandText = "insert into " + this._table + " (" + str1 + ") values (" + str2 + ")";
            this.cmd.CommandType = CommandType.Text;
            this.cmd.ExecuteNonQuery();
            if (!ex)
            {
                this.connection.Close();
            }
            else
            {
                this.values.Clear();
                this.values2.Clear();
            }
        }
Exemplo n.º 5
0
 public void on()
 {
     this.connection = SQLjec.getInstance().conn();
     this.cmd        = this.connection.CreateCommand();
     this.connection.Open();
 }
Exemplo n.º 6
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();
            }
        }