Franken_.App_Code.DataPipe.ExecuteCommand C# (CSharp) Method

ExecuteCommand() public method

public ExecuteCommand ( string CommandStatement ) : bool
CommandStatement string
return bool
        public bool ExecuteCommand(string CommandStatement)
        {
            LastSQL = CommandStatement;
            bool Executed = false;
            try
            {
                Conn.Open();
                SQL.CommandText = CommandStatement;
                if (SQL.ExecuteNonQuery() > 0)
                {
                    Executed = true;
                }
                Conn.Close();
            }
            catch (Exception E)
            {
                if (Conn.State == ConnectionState.Open)
                {
                    Conn.Close();
                }
                ReportError(E.Message, "ExecuteCommand");
            }

            return Executed;
        }

Usage Example

Example #1
0
        public void Save(bool IncludeChildren)
        {
            if (this.ID == "")
            {
                this.ID = db.GetNewID("glyphs");
                db.ExecuteCommand("insert into glyphs (glyph_id, glyph_font_id, glyph_unicode, glyph_frequency, glyph_x_offset, glyph_y_offset) values (" + this.ID + ", " + this.FontID + ", '" + db.FixString(this.Unicode) + "', " + this.Frequency + ", " + this.XOffset + ", " + this.YOffset + ")");
            }
            else
            {
                db.ExecuteCommand("update glyphs set glyph_font_id = " + this.FontID + ", " +
                                  "glyph_unicode = '" + db.FixString(this.Unicode) + "', " +
                                  "glyph_frequency = " + this.Frequency + ", " +
                                  "glyph_x_offset = " + this.XOffset + ", " +
                                  "glyph_y_offset = " + this.YOffset + " " +
                                  "where glyph_id = " + this.ID);

                if (this.Images != null && IncludeChildren)
                {
                    for (int x = 0; x < this.Images.Count; x++)
                    {
                        this.Images[x].Save();
                    }
                }
            }
        }
All Usage Examples Of Franken_.App_Code.DataPipe::ExecuteCommand