Ejemplo n.º 1
0
 private void DoDeleteCommand(SQLiteConnection sqlcon, SQLDeleteTable table)
 {
     CommandPerformed = $"{table.GetSqlWithParameters()}{Environment.NewLine}{table.GetParamList().ToString()}{Environment.NewLine}";
     SQLPerformed     = table.GetSql();
     try
     {
         SqliteConnection db = sqlcon.GetConnection();
         using (SqliteCommand command = db.CreateCommand())
         {
             command.CommandText = table.GetSqlWithParameters();
             List <SqliteParameter> Params = GetCommandParameters(table.GetParamList());
             if (Params.Count > 0)
             {
                 foreach (var p in Params)
                 {
                     command.Parameters.Add(p);
                 }
             }
             command.ExecuteNonQuery();
             Success = true;
         }
     }
     catch
     {
         Success = false;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor that takes the table name, there where values that are to be used delete the matching records. It can also take a bool value to delete everything
        /// </summary>
        /// <param name="sqlcon"></param>
        /// <param name="TableName"></param>
        /// <param name="WhereFields"></param>
        /// <param name="deleteallrecords"></param>
        public SQLiteDelete(SQLiteConnection sqlcon, string TableName, SQLWhereVars WhereFields, bool deleteallrecords = false)
        {
            SQLDeleteTable table = new SQLDeleteTable(TableName, WhereFields, deleteallrecords);

            DoDeleteCommand(sqlcon, table);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor that takes the database connection and the delete table that contains the information for the command
 /// </summary>
 /// <param name="sqlcon"></param>
 /// <param name="table"></param>
 public SQLiteDelete(SQLiteConnection sqlcon, SQLDeleteTable table)
 {
     DoDeleteCommand(sqlcon, table);
 }