C # WPF DataGrid not showing decimal from SQLite 3 database

I am having a problem with C # WPF where I want to show some SQLite data table in a WPF DataGrid control. We save the price of the product as NUMERIC (but also as REAL, but it does the same), but in the datagrid control it is displayed as an integer, despite the fact that in SQLite DB Browser it displays the correct decimal value. Here is the code with which we populate the data in the DataGrid:

ProductsDataGrid.ItemsSource = db.GetDataSet("*", "products").Tables[0].AsDataView();

and the GetDataSet method is as follows:

public DataSet GetDataSet(string columns, string table, string trailingCommands = "")
{
    var sqlcmd = string.Format("select {0} from {1} {2}", columns, table, trailingCommands);
    Utility.Log.Info(sqlcmd);
    DataSet dataSet = new DataSet();
    SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(sqlcmd, this.dbconn);
    dataAdapter.Fill(dataSet);

    return dataSet;
}

Short version: Program shows decimal numbers as int in datagrid from SQLite DB

+4
source share
1 answer

SQLite, .

+1

Source: https://habr.com/ru/post/1657399/


All Articles