I'm working with winforms and hit a problem.
I have some data in sql and one of the columns is a sql generated unix timestamp. The sql is updating itself, so I can´t change the data in the datatable.
So i'm populating the datatable and then i use this ("to get the newest items"):
DataView dv = db.historyDataSet.Tables["historyTable"].AsEnumerable().Where(r => (Convert.ToInt64(r["timestamp"])) > (time)).AsDataView();
This generates my dataview, and from that I want to simply populate a dataGridWiew by:
dataGridView.DataSource = dv;
But how do I get the datagridview to show human readable time (I am using a function for that called timeConvert - the conversion is not my problem)
I do this:
foreach (DataGridViewRow row in batchvisGridView.Rows)
{
DataRow dr = ((DataRowView)row.DataBoundItem).Row;
dr["timestamp"] = timeConvert(Convert.ToInt64(dr["timestamp"]));
}
But I get an error that says I cant store the string in the cell because it has a different type: Additional information: Inputstring was not in correct format.<10:35 26/03-16> couldn' t be saved in timestamp. Expected type is Int32.
How do I do this the best way? (and I don' t want to change database)