home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 19,050 of 19,505   
   Tony Johansson to All   
   How to remove the time part from a field   
   15 Mar 14 14:37:34   
   
   From: johansson.andersson@telia.com   
      
   In this method GetBokningar I fetch all rows and return a DataSet but I hope   
   I can remove the time part in some way.   
   Now I get for example format 2013-03-12 00:00:00 for columns BokningFromDate   
   and BokningToDate because these are DateTime column in the database.   
   I could use  a DataReader and convert to string but I hope I can fix it   
   within sql in some way.   
      
   public DataSet GetBokningar()   
     {   
      Command.Parameters.Clear();   
      Connection.Open();   
      
      Command.CommandText = "SELECT BokningFromDate, BokningToDate, Name,   
   Address, Phone, ProductID, EnhetsPris " +   
             "FROM Bokningar " +   
             "INNER JOIN Customers " +   
             "ON Bokningar.CustomerID = Customers.CustomerID " +   
             "INNER JOIN BokningDetails " +   
             "ON Bokningar.BokningarID = BokningDetails.BokningarID " +   
             "ORDER BY Name asc";   
      
      dataAdapter = new SqlDataAdapter(Command);   
      DataSet ds = new DataSet();   
      dataAdapter.Fill(ds, "Products");   
      return ds;   
     }   
      
   //Tony   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca