/// <summary> /// Обновление таблицы в БД. /// </summary> /// <param name="dTable">набор данных</param> /// <param name="tblname">enum нужной таблицы</param> /// <returns></returns> public void UpdateDataTable(DataTable dTable, dbTables tblname) { if (dTable == null) { return; } var stmnt = TableSelector.GetSelectStatement(tblname); if (String.IsNullOrEmpty(stmnt)) { return; } m_sqlCmd.CommandText = stmnt; var dataAdapter = new SQLiteDataAdapter(m_sqlCmd); var commandBuilder = new SQLiteCommandBuilder(dataAdapter); dataAdapter.Update(dTable); }
/// <summary> /// Чтения таблицы из БД. /// </summary> /// <param name="tblname">enum нужной таблицы</param> /// <returns>DataTable</returns> public DataTable GetDataTable(dbTables tblname) { var stmnt = TableSelector.GetSelectStatement(tblname); if (String.IsNullOrEmpty(stmnt)) { return(null); } DataTable dTable = new DataTable(); try { SQLiteDataAdapter adapter = new SQLiteDataAdapter(stmnt, m_dbConn); adapter.Fill(dTable); } catch (SQLiteException ex) { //MessageBox.Show("Error: " + ex.Message); } return(dTable); }