[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Group by in datagrid

Posted on 2006-03-31
Medium Priority
Last Modified: 2009-12-16
I have a query that returns to me the last 3 days and this data is written to a datagrid.  This is working.  The only problem is that I would like to group it by date so that the I can get all information for one date on one line.

Currently it is displayed at

IN Date                         Out Date
03/30/2006 8:00 AM       03/30/2006  12:00 PM
03/30/2006 1:00 PM       03/30/2006    5:00 PM

I would like it to display as, the fields in the database are datatime.  Thank you

Date           InTime      OutTime      InTime       OutTime                      
03/30/2006 8:00 AM    12:00 PM     1:00 PM     5:00 PM

**********current sql query *************
 objCmd.CommandText = "select eh.recordid, firstname + ' ' +  lastname as name, timein, timeout from employeehours as eh inner join employeelist as el on eh.employeeid = el.employeeid where firstname = 'Justine' and lastname = 'Cleary' and timein  > CONVERT(datetime, '" & strCurrentdate & "', 102) order by timein "
Question by:running32
1 Comment

Accepted Solution

Raju Srivatsavaye earned 1500 total points
ID: 16345856
for getting date and time fields try doing this..

select INDate as [Date],
          substring(convert(varchar,InDate,12,8)) as Intime,....similarly the rest..

tell me if this works

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month19 days, 5 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question