Hi people,
im importing a date column from a mysql database to a datagridview but it automatically changes the date format from 'YYYY-MM-DD' (Mysql format) to 'MM/DD/YYYY'
since the user has to type in the date in mysql format to update or insert new records, I want to force the datagridview to display the date column in mysql format for consistency.
Heres my code for that:
dataGridView1.D ataSource = loadData();
private DataTable loadData()
{
string connectString =
"datasource=loc alhost;username =admin;password =student;databa se=hospital";
string selectStatmnt =
"SELECT NurseID, Firstname, Surname, Qualification, WorkType, DOB FROM nurses";
mySqlDataAd = new MySqlDataAdapte r(selectStatmnt , connectString);
nursesTable = new DataTable();
mySqlDataAd.Fil lSchema(nursesT able, SchemaType.Sour ce);
mySqlDataAd.Fil l(nursesTable);
return nursesTable;
}
Any help would be appreciated
im importing a date column from a mysql database to a datagridview but it automatically changes the date format from 'YYYY-MM-DD' (Mysql format) to 'MM/DD/YYYY'
since the user has to type in the date in mysql format to update or insert new records, I want to force the datagridview to display the date column in mysql format for consistency.
Heres my code for that:
dataGridView1.D ataSource = loadData();
private DataTable loadData()
{
string connectString =
"datasource=loc alhost;username =admin;password =student;databa se=hospital";
string selectStatmnt =
"SELECT NurseID, Firstname, Surname, Qualification, WorkType, DOB FROM nurses";
mySqlDataAd = new MySqlDataAdapte r(selectStatmnt , connectString);
nursesTable = new DataTable();
mySqlDataAd.Fil lSchema(nursesT able, SchemaType.Sour ce);
mySqlDataAd.Fil l(nursesTable);
return nursesTable;
}
Any help would be appreciated