0

I'm trying to populate a DGV with a Data Table that's filled with some information from a MySQL database, but it isn't returning the time along with the date. When I put my Select Statement into MySQL Workbench it does show the time and date. When I put the same Select statement into my Visual Studio C# app it only shows the date.

The startTime is type DateTime it's inserted into the table in the format '2021-01-01 00:00:00'.

And my select statement looks like this.

select name as 'Name', custID as 'Customer ID', startTime as 'Start Time' from customer join appointment using (custID);

In mySQL workbench the Start Time column will appear with 2021-01-01 00:00:00. In the DGV it appears as just 1/1/2021.

DiplomacyNotWar
  • 31,605
  • 6
  • 57
  • 75
  • 1
    This seems to have little to do with MYSQL and much more to do with the formatting setting of your DGV column. I recommend looking up how to change the formatting. – DiplomacyNotWar Jan 23 '22 at 03:06
  • 1
    The code that you've supplied isn't sufficient to replicate the issue. Please provide a [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) – user9938 Jan 23 '22 at 03:12
  • Awesome, thank you. That was the problem. – user17195990 Jan 23 '22 at 03:14

0 Answers0