Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is my code:
C#
SqlDataAdapter dtd = new SqlDataAdapter("select Date From Sale ", conn);
           DataTable dt = new DataTable();
           dtd.Fill(dt);
           string tra = dt.Rows[0]["Date"].ToString();
           MessageBox.Show(tra);

i am retrieving date in Sql server database.. But my problem is time does not exist in date column. then time also retrieve with date and then time does not exist,,,,
in database date column consist only date,,,
Plz Help,,,
Posted
Updated 16-Aug-12 7:42am
v2

1 solution

So is the problem that since the column in the database is a simple date and no time portion at all and when you convert it to datetime or string in C# you see somethinh like 00:00:00 in the date.

If this is the case, then you can format the string the way you want to display the date. For example, see DateTime.ToString Method (String)[^] and Standard Date and Time Format Strings[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900