Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime Displaying Without Time in Datagrid Control 1

Status
Not open for further replies.

markk609

Programmer
Feb 19, 2005
11
US
I have a Windows Form application with a datagrid that is populated with a dataset based on a query of a SQL Server table. Access to the SQL Server database is by way of Web services. Some of the fields in the underlying SQL Server table are of the DateTime data type and they display properly as such (with both date and time) when the table is opened in SQL Enterprise Manager. However, these same DateTime values display in my datagrid without the time portion of the value. There is absolutely no conversion from DateTime to Date in the query that serves as the basis for the datagrid's dataset. There must be something relatively simple (perhaps with regard to a System.DateTime property setting or the like) that I am failing to take account of. Can anyone suggest what it might be?
 
Mark

The simplest way is to format the date how you want to see it from SQL. The default grid formatting is just to show the date portion.

see thread796-1057444, which contains a SQL Date formatting function

Sweep
...if it works dont mess with it
 
I think I can put that UDF to good use. Many thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top