sorting on merged datasets

I have merged two datasets but now need to sort on the dtmappt so that the dates display correctly.  How can I sort on a merged dataset please?

thanks
MyCommand = New SqlDataAdapter("SELECT  a.APPTDATE as apptdate, a.APPTREASON AS apptreason  FROM tblPSPatient s INNER JOIN HealthDistrict.dbo.DDB_PAT_BASE p ON s.lngPatientid = p.CHART INNER JOIN HealthDistrict.dbo.DDB_APPT_BASE a ON p.PATID = a.PATID  where lngPSPatientid = '" & patid & "'and a.apptdate > '" & brokendate & "'  ORDER BY s.lngPSPatientid, a.APPTDATE", Connection1)
            DS1 = New DataSet
            MyCommand.Fill(DS1, "MyTable")
 
            MyCommand = New SqlDataAdapter("SELECT d.dtmScreening as apptdate,   'Project Smile Screening' AS apptreason FROM HealthDistrict.dbo.tblDentalScreening d INNER JOIN HealthDistrict.dbo.tblPatient p ON d.lngPatientid = p.lngPatientId LEFT OUTER JOIN tblPSPatient pat ON p.strLName = pat.strlname AND p.strFName = pat.strfname AND p.strPatientId = pat.lngPatientid  where lngPSPatientid = '" & patid & "' ", Connection1)
            DS2 = New DataSet
            MyCommand.Fill(DS2, "MyTable")
 
 
            ds1.merge(ds2)

Open in new window

running32Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vs1784Commented:
if you are using 2005 you can do following

DataView dv = new DataView(ds1.Tables[0]);
string order = "dtmappt ASC";
dv.Sort = order;

dv.totable(<Nerw Table you want to copy sorted data to>)

Thanks,
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
running32Author Commented:
I am using 2003.net  visual basic.  Thanks
0
vs1784Commented:
Then you have to loop through the data view and insert each row in to new dataset.
0
running32Author Commented:
I was able to modify.  Thanks so much

 Dim dv1 As New DataView(DS1.Tables(0))
            dv1.Sort = "apptdate desc"
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.