I've been researching this issue for over a day, read a lot of posts and tried many formatting options but no joy. Essentially I'm populating a datagridview from a database with an OleDbDataAdapter connection. The date columns are formatted properly in the database, but dates come across as very large double numbers (10 digits). I've tried creating a new formatted column in the SQL statement, but just get a shorter number (5 digits), i.e. select START_DATE, datepart(START_DATE) as SDATE format=date9. from table ; So instead of 1776772799, I get 20550 ... when I look at the actual table the formatted value is 06APR2016:00:00:00 ... or 06APR2016 with the date9 database format. The odd thing with my situation is that every attempt to 'format' just puts the format value as a string. I can't embed an image, but the formatted date column show [dd/MMM/yyyy] (or whatever format I try to use) and the unformatted column shows a number, i.e. [1776772799]. Looking for some ideas. thanks
private void loadForm()
{
OleDbConnection conn3 = new OleDbConnection(conn3str);
string qEvent = "select * from tablename ;";
//string qEvent = select * , datepart(START_DATE) as SDate format=date9. from tablename ;
OleDbDataAdapter daEvent = new OleDbDataAdapter(qEvent, conn3);
DataSet dsEvent = new DataSet();
conn3.Open();
daEvent.Fill(dsEvent, "event_table");
conn3.Close();
dgvMngEvnts.DataSource = dsEvent;
dgvMngEvnts.DataMember = "event_table";
dgvMngEvnts.Rows[0].Selected = false;
//string dgvFormat = "dd/MMM/yyyy";
//dgvMngEvnts.Columns[4].DefaultCellStyle.Format = dgvFormat;
dgvMngEvnts.Columns[4].DefaultCellStyle.Format =@"dd/MMM/yyyy";
//dgvMngEvnts.Columns[4].DefaultCellStyle = new DataGridViewCellStyle { Format = "dd'/'MM'/'yyyy" };
}