Example #1
0
        public static DataRow CreateRow(string tableName)
        {
            var row = GetTable(tableName).NewRow();

            row[TableKeys.GetPrimaryKey(tableName)] = GetNewId(tableName);
            return(row);
        }
Example #2
0
        /// <summary>
        /// Удаляет строку из базы и из таблицы
        /// </summary>
        public static void DeleteRow(DataTable table, DataRow deletedRow)
        {
            var    pkKey = TableKeys.GetPrimaryKey(table.TableName);
            string query = CreateDeleteQuery(table.TableName, pkKey, deletedRow[pkKey].ToString());

            if (DataBaseConnector.ExecuteNonQuery(query))
            {
                DeleteRowFromTable(table, deletedRow);
            }
        }