I have a Sqlite database whit a table like below, but I wan to display in a datagrid using windows forms in c#
Warehouse Product Amount
========= ======= ======
1 p1 1
1 p2 2
1 p3 3
2 p1 4
2 p2 5
2 p3 6
3 p1 7
3 p2 8
3 p3 9
I want to display like this
Warehouse p1 p2 p3...
========= == == ==
1 1 2 3
2 4 5 6
3 7 8 9
I used this code to fill the datagrid like the one example
DataSet dataSet = new DataSet();
var sql = "select Warehouse, Product,Amount from existencias_dump";
SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(sql, db.m_dbConnection);
dataAdapter.Fill(dataSet);
var table = dataSet.Tables[0];
dataGridView1.DataSource = dataSet.Tables[0].DefaultView;
I want to display like the second but don't know were are recomended changes in the sqlite query or in the final dataset in both cases I don't know exactly how to proced
Aucun commentaire:
Enregistrer un commentaire