running32
asked on
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
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)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then you have to loop through the data view and insert each row in to new dataset.
ASKER
I was able to modify. Thanks so much
Dim dv1 As New DataView(DS1.Tables(0))
dv1.Sort = "apptdate desc"
Dim dv1 As New DataView(DS1.Tables(0))
dv1.Sort = "apptdate desc"
ASKER