|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataSet, Finding Unique Values in TableMy Dataset has one table. That table contains medical services for patients. Each row is one service for a patient, patients may have multiple service records. I need to make a list of the patients in this table. I'd like to avoid a second trip to the database based on the time it would take for the query. If this were Access, I would copy the table, create a new table with the same structure, set the unique index for no duplicates and append the records to the new table. All the duplicate patients would error out and I would end up with one row for each patient. Is there a similar way to do something like this with DataSets? If not, I'll have to make a new table to hold the patient list and step through the current table checking each record to see if it's contained in the new list. Is there an easier way to do this? Thanks, Bernie Bernie,
Normally you get this with a distinct on the database. The same with a table can be done by instance by this routine. http://www.vb-tips.com/default.aspx?ID=dcad9a66-1366-4d61-8d32-1a580eb893b2 I hope this helps, Cor Show quote "Bernie Hunt" <bh***@optonline.net> schreef in bericht news:Xns97ACE43C410A5bhuntoptonlinenet@207.46.248.16... >I have problem I don't know how to solve in a Dataset. > > My Dataset has one table. That table contains medical services for > patients. Each row is one service for a patient, patients may have > multiple > service records. I need to make a list of the patients in this table. I'd > like to avoid a second trip to the database based on the time it would > take > for the query. > > If this were Access, I would copy the table, create a new table with the > same structure, set the unique index for no duplicates and append the > records to the new table. All the duplicate patients would error out and I > would end up with one row for each patient. > > Is there a similar way to do something like this with DataSets? > > If not, I'll have to make a new table to hold the patient list and step > through the current table checking each record to see if it's contained in > the new list. > > Is there an easier way to do this? > > Thanks, > Bernie Thanks Cor!
Always helpful as usual! So I guess I'm keeping my routine of steping through all the records, hahahaha. Bernie Show quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in news:#6sCk$fZGHA.3532@TK2MSFTNGP05.phx.gbl: > Bernie, > > Normally you get this with a distinct on the database. > > The same with a table can be done by instance by this routine. > > http://www.vb-tips.com/default.aspx?ID=dcad9a66-1366-4d61-8d32-1a580eb8 > 93b2 > > I hope this helps, > > Cor > |
|||||||||||||||||||||||