Hello,
I have a stored procedure that populates dates in SQL Server 2012 (InsDate AS date). When I execute the spoc i get InsDate=2015-06-06 which is the format I need.
I retieve data into my webform using the following code:
SqlCommand command = new SqlCommand("SelectSproc", connection);
command.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adapter = new SqlDataAdapter(command);
DataSet ds = new DataSet();
adapter.Fill(ds);
insDate.Text = ds.Tables[0].Rows[0]["InsDate"].ToString();
Result: insDate.Text= 2015-06-06 12:00:00 am
Why do I get the time part since I'm populating only dates from the SQL? How can I get rid of the time part?
Thank you in advance.
8 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Hemlata KushwahaPosted Sep 24, 2015, 3:14 AM
Hemlata KushwahaPosted Sep 24, 2015, 3:52 AM
Chriz LPosted Sep 24, 2015, 3:18 AM
Manas MohapatraPosted Sep 24, 2015, 3:14 AM
Chriz LPosted Sep 24, 2015, 3:08 AM
Hemlata KushwahaPosted Sep 24, 2015, 3:04 AM
Chriz LPosted Sep 24, 2015, 2:55 AM
Manas MohapatraPosted Sep 24, 2015, 2:50 AM