H
Horselover Fat
Hi,
I have a column in a database that holds elapsed time in milliseconds
and I want to display that column in a DataGrid in a specific format
(d.hh:mm:ss.fff). However, the closest I can get is d.hh:mm:ss.ffffff.
Code snippets follow:
dt = new DataTable("Errors");
dt.Columns.Add("Occurred", typeof(TimeSpan));
// SELECT statement transforms milliseconds into ticks
string command = String.Format("SELECT (err.occurred*{0}) as Occurred
FROM errors err ORDER BY err.occurred",
TimeSpan.TicksPerMillisecond.ToString());
adapter = new SQLiteDataAdapter(command, this.TestDataView.Run.DBConn);
adapter.TableMappings.Add("Table", "Errors");
adapter.Fill(dt);
The column style is DataGridTextBoxColumn and I tried setting the
Format property to d.hh:mm:ss.fff but with no effect. I guess I've
misunderstood the fundamentals here. Presumably, the column in the
datagrid is just displaying the default ToString() representation of
TimeSpan. How do I make it use a format string to display the output I
want?
Any help greatly appreciated.
I have a column in a database that holds elapsed time in milliseconds
and I want to display that column in a DataGrid in a specific format
(d.hh:mm:ss.fff). However, the closest I can get is d.hh:mm:ss.ffffff.
Code snippets follow:
dt = new DataTable("Errors");
dt.Columns.Add("Occurred", typeof(TimeSpan));
// SELECT statement transforms milliseconds into ticks
string command = String.Format("SELECT (err.occurred*{0}) as Occurred
FROM errors err ORDER BY err.occurred",
TimeSpan.TicksPerMillisecond.ToString());
adapter = new SQLiteDataAdapter(command, this.TestDataView.Run.DBConn);
adapter.TableMappings.Add("Table", "Errors");
adapter.Fill(dt);
The column style is DataGridTextBoxColumn and I tried setting the
Format property to d.hh:mm:ss.fff but with no effect. I guess I've
misunderstood the fundamentals here. Presumably, the column in the
datagrid is just displaying the default ToString() representation of
TimeSpan. How do I make it use a format string to display the output I
want?
Any help greatly appreciated.