Goran Bibic

Goran Bibic

  • 446
  • 2.9k
  • 192.1k

Select date from sql specified format c#

Jun 5 2018 2:55 PM
Select date from sql specified format?
 
  1. string date = "";  
  2. using (SqlConnection openCon = new SqlConnection(cs))  
  3. {  
  4.     SqlDataReader reader;  
  5.     SqlCommand cmd = new SqlCommand();  
  6.     cmd.CommandText = "select datum from mp_racun_lista where id=" + id_fakture;  
  7.      cmd.Connection = openCon10;  
  8.      openCon.Open();  
  9.      reader = cmd.ExecuteReader();  
  10.   
  11.      while (reader.Read())  
  12.      {  
  13.          date = reader[0].ToString();
  14.      }  
  15.      openCon.Close();  

 

Answers (4)