Bonjour,
Je découvre petit à petit WPF C#, je développe un projet :
J'ai 2 tables (Sqlite) qui s'affichent chacune dans une Datagrid, l'utilisateur peut y entrer des données, les modifier ou supprimer.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 SQLiteConnection sqliteCon = new SQLiteConnection(Properties.Settings.Default.DbConnectionString); public Page2() { InitializeComponent(); string dbConnectiongString = @"Data Source=database.db;Version=3;"; SQLiteConnection sqliteCon = new SQLiteConnection(dbConnectiongString); // ouvrir la base de donnée try { sqliteCon.Open(); string Query = "select ID,Compte,Date_Opération,Date_Valeur,Statut,Code_flux,Libellé,Sens,Référence,Montant,devise from Flux "; SQLiteCommand createCommand = new SQLiteCommand(Query, sqliteCon); createCommand.ExecuteNonQuery(); SQLiteDataAdapter DataAdp = new SQLiteDataAdapter(createCommand); DataTable dt = new DataTable("Flux"); DataAdp.Fill(dt); Dgflux.ItemsSource = dt.DefaultView; DataAdp.Update(dt); sqliteCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
Je souhaiterais avoir une 3ème datagrid ou autre chose qui me permettrait d'y faire un récapitulatif à la manière d'un TCD.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 SQLiteConnection sqliteCon = new SQLiteConnection(Properties.Settings.Default.DbConnectionString); public Window4() //Récupérer élément d'une table dans liste déroulante { InitializeComponent(); string dbConnectiongString = @"Data Source=database.db;Version=3;"; SQLiteConnection sqliteCon = new SQLiteConnection(dbConnectiongString); // ouvrir la base de donnée try { sqliteCon.Open(); string Query = "select ID,Intitulé,Date,Solde,Devise from Soldes_bancaires "; SQLiteCommand createCommand = new SQLiteCommand(Query, sqliteCon); createCommand.ExecuteNonQuery(); SQLiteDataAdapter DataAdp = new SQLiteDataAdapter(createCommand); DataTable dt = new DataTable("Soldes_bancaires"); DataAdp.Fill(dt); Soldes.ItemsSource = dt.DefaultView; DataAdp.Update(dt); sqliteCon.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message);
Donc est-ce q'un datagrid peut être utilisé ou autre chose ?
J'ai besoin que les données de certains champs de mes tables (date et montant) soient disposés à l'horizontal.
De plus, j'aimerais pouvoir y ajouter des lignes de sous-totaux et totaux.
Pouvez-vous m'éclairer sur la faisabilité et une méthode ? SVP
Merci
Partager