我正在使用下面的代码从包含日期列的 SQLite3 数据库中填充我的程序中的数据网格视图
此日期列以 Unix 时间存储,我想将其显示为正常日期
当我将数据库读入数据网格视图时,有没有办法可以做到这一点?
SQLiteConnectionStringBuilder csb = new SQLiteConnectionStringBuilder();
csb.DataSource = Path.Combine(connectionPath, "sms.db");
SQLiteConnection connection = new SQLiteConnection(csb.ConnectionString);
connection.Open();
// SQL query to read the data fromt he database
SQLiteCommand command = connection.CreateCommand();
//Read Everything
string query = "SELECT * FROM message";
command.CommandText = query;
SQLiteDataAdapter dataAdaptor = new SQLiteDataAdapter(command);
DataSet dataset = new DataSet();
dataAdaptor.Fill(dataset, "Messages");
// Get the table from the data set
DataTable datatable = dataset.Tables["Messages"];
dataGridSMS.DataSource = datatable;