Shivaraj Poojary

Shivaraj Poojary

  • NA
  • 92
  • 314.4k

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");
            con.Open();
            SqlCommand cm = new SqlCommand("SELECT MAX(DateTime) as dd from TB_StudentLogin",con);
            SqlDataReader dr = cm.ExecuteReader();
            dr.Read();




Answers (8)