Reputation: 19
I've sql database which is connected to c# windows form in the database there's column with date , data type only date dd/mm/yyyy and the data inside this column is also saved the same I've a gridview in the C# which retrieve all the data into it, it shows the date asin database dd/mm/yyyy I've a trigger " SelectionChanged" on the grid and it copies the data into textBoxes , but the date always comes with time dd/mm/yyyy tt:mm:ss AM/PM which is not in the Database at all what I'm missing ?
checked the datatypein sql, it showed only dd/mm/yyyy no date in datatype or in thedata itself reconnected the database to the C# application, recreated the gridview
Upvotes: 0
Views: 163
Reputation: 33
You can use
dgv.Columns["DateColumnName"].DefaultCellStyle.Format = "dd/MM/yyyy"
Upvotes: 2