How to select DISTINCT when using typed dataset and a ole data adapter?

  • Thread starter Thread starter Henke
  • Start date Start date
H

Henke

Hi

Is it possible to not get duplicates when using a data adapter,
SelectCommand.Parameters and the Fill-method?
I would like something that adds the DESTINCT parameter the select command.
I have created all my select-commands in the designer.

Thanks
 
Henke:

You can use Select Distinct(whatever) and set it as your adapter's select
command. However, you'd probably be better off pulling the data over and
using something like this
http://support.microsoft.com/default.aspx?scid=kb;EN-US;326176 which creates
the Distinct values locally . If you use select distinct as your select
command, updating is going to be a real pain (next to impossible) but you
can use it at either end.

HTH,

Bill
 
Yes that helps, thanks. I hoped that there would be some temporary select
distinct command that could be applied when getting values from the
database, but unfortunately not...

I'll try the HelpClass solution.

/Henke
 
Henke:

I'm still confused.. are you looking for a SQL Command to do this server
side, or are you looking for something that can be done once you have a
datatable from calling DataAdapter.Fill?
 
Shouldn't it be nice if you had a Property on the data adapter,
Distinct=True/False, and then when call the Fill method, no duplicates
should be added to the dataset. So the answer to your question is that the
best thing would be if it could be done server side.

/Henke
 
Back
Top