Shivaraj Poojary

Shivaraj Poojary

  • 1.8k
  • 92
  • 283.1k

How to seperate date and time while retrieving from sqlserver 2005

Apr 27 2011 12:44 AM
Hi Experts...
 I have stored "DateTime" format in the database, but i need only "date" at the time of retrive. How to do this? Please help me..

I have the following code

            SqlConnection con = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;User ID=CRYSYS1-DESKTOP\\Student;Initial Catalog=StdLab;Data Source=CRYSYS1-DESKTOP\\SQLEXPRESS");
            SqlCommand cm = new SqlCommand("SELECT MAX(DateTime) as dd from TB_StudentLogin",con);
            SqlDataReader dr = cm.ExecuteReader();

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (8)