-

   rss_forum_sources_ru

 - e-mail

 

 -

 LiveInternet.ru:
: 29.07.2007
:
:
: 80

:


SQLite+DataGridView

, 21 2020 . 20:29 +
hd44780: .
.

, 3 - 3 :
1. - , , ..
2. - , (id ), ,
3. - , .

id - primary key, id_client - foreign key - .
.

C#, WinForms, NET4.0. , WPF - , , .
2- - . 3- - , .
, . .

- Combobox, - https://khanrahim.wordpress.com/2010/04/13/...agridview-in-c/
- ( ) CellValueChanged , "". . -, , , - .
repairs_adapter.Update(repairs_dt); -- .

, InsertCommand, UpdateCommand.
    string s_query = string.Format(@"SELECT * FROM repairs WHERE repairs.id_client = {0}", id_client_for_repair);
    // string s_query = string.Format(@"SELECT repairs.date, repairs.id_repair_type, repairs.repair_note, repairs.master_fio, repairs.summa
    // FROM repairs WHERE repairs.id_client = {0}", id_client);
    repairs_adapter = new SQLiteDataAdapter(s_query, m_dbConn);
    SQLiteCommandBuilder cb = new SQLiteCommandBuilder(repairs_adapter);
    repairs_adapter.UpdateCommand = cb.GetUpdateCommand();
    repairs_adapter.InsertCommand = cb.GetInsertCommand();
    repairs_adapter.DeleteCommand = cb.GetDeleteCommand();


, , , UpdateCommand:
    "UPDATE [main].[sqlite_default_schema].[repairs] SET [id_client] = @param1, [date] = @param2, [id_repair_type] = @param3, [repair_note] = @param4, [master_fio] = @param5, [summa] = @param6 WHERE (([id_repair] = @param7) AND ([id_client] = @param8) AND ([date] = @param9) AND ([id_repair_type] = @param10) AND ((@param11 = 1 AND [repair_note] IS NULL) OR ([repair_note] = @param12)) AND ([master_fio] = @param13) AND ((@param14 = 1 AND [summa] IS NULL) OR ([summa] = @param15)))"


, @paramXX?
id_repair - primary key, .. WHERE . ? , - .

id_client ,
    foreach (DataGridViewRow row in dataGridViewRepairs.Rows)
    {
    row.Cells[1].Value = id_client_for_repair.ToString();
    } // foreach

repairs_adapter.Update(repairs_dt);

- - , ?
SQL Server - , InsertCommand , . SQLite - .

.

https://forum.sources.ru/index.php?showtopic=419407&view=findpost&p=3837421

:  

: [1] []
 

:
: 

: ( )

:

  URL