Hey all,
Is there a way to get similar functionality as the SELECT DISTINCT records
in a SQL Statement when selecting records from a dataset?
thanks,
rodchar 4 1931
No, but this article could help you build one: http://weblogs.sqlteam.com/davidm/ar...01/21/753.aspx
Essentially, you need to traverse all rows and choose only those that have
distinct column values you are looking for.
--
Manohar Kamath
Editor, .netWire www.dotnetwire.com
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message
news:2F******** *************** ***********@mic rosoft.com... Hey all,
Is there a way to get similar functionality as the SELECT DISTINCT records in a SQL Statement when selecting records from a dataset?
thanks, rodchar
Just realized there is a KB article as well: http://support.microsoft.com/default...b;en-us;326176
--
Manohar Kamath
Editor, .netWire www.dotnetwire.com
"Manohar Kamath" <mk*****@TAKETH ISOUTkamath.com > wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. No, but this article could help you build one:
http://weblogs.sqlteam.com/davidm/ar...01/21/753.aspx
Essentially, you need to traverse all rows and choose only those that have distinct column values you are looking for.
-- Manohar Kamath Editor, .netWire www.dotnetwire.com
"rodchar" <ro*****@discus sions.microsoft .com> wrote in message news:2F******** *************** ***********@mic rosoft.com... Hey all,
Is there a way to get similar functionality as the SELECT DISTINCT
records in a SQL Statement when selecting records from a dataset?
thanks, rodchar
Thanks everyone for the feedback.
"rodchar" wrote: Hey all,
Is there a way to get similar functionality as the SELECT DISTINCT records in a SQL Statement when selecting records from a dataset?
thanks, rodchar
Hey I have question about the code. Why use Object as data type for
LastValue? Very new to objects.
Public Function SelectDistinct( ByVal TableName As String, ByVal
SourceTable As DataTable, ByVal FieldName As String) As DataTable
Dim dt As New DataTable(Table Name)
dt.Columns.Add( FieldName, SourceTable.Col umns(FieldName) .DataType)
Dim LastValue As Object = Nothing
Dim dr As DataRow
For Each dr In SourceTable.Sel ect("", FieldName)
If LastValue Is Nothing Or Not ColumnEqual(Las tValue,
dr(FieldName)) Then
LastValue = dr(FieldName)
dt.Rows.Add(New Object() {LastValue})
End If
Next dr
If Not (ds Is Nothing) Then
ds.Tables.Add(d t)
End If
Return dt
End Function 'SelectDistinct
"rodchar" wrote: Thanks everyone for the feedback.
"rodchar" wrote:
Hey all,
Is there a way to get similar functionality as the SELECT DISTINCT records in a SQL Statement when selecting records from a dataset?
thanks, rodchar This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ramesh |
last post by:
hi,
I am selecting fields from three table for manupulating
data and i want to display total number of records
selected. But i am always getting -1 value, eventhough
1000 of records are selected. Below is my code. here
strSelectSQL value is
strSelectSQL = "Select emp.Empno, emp.FirstName,
emp.LastName, emp.DB,
emp.DOJ,emp.Grade,emp.yearofexperience,
|
by: aaj |
last post by:
Hi all
I use a data adapter to read numerous tables in to a dataset.
The dataset holds tables which in turn holds full details of the records
i.e. keys, extra colums etc..
In some cases I need to use parts of the tables in datagrids, and here is
where my problem lies
|
by: Aaron Ackerman |
last post by:
I have been having just on going problems with my MS Datagrids. I have NO
idea what I am doing wrong.
What is esentially happening is that say I have three records in my Dataset.
I click on the third row to populate the textboxes below the grid that
correspond to the various columns in the grid. The textboxes fill. I edit
the data in one of the textboxes. As I lose focus I update the dataset and
refresh the grid.
Well the third row...
|
by: Ron L |
last post by:
I have a data table that lists a series of items in my database. In my user
form, I want the user to be able to filter by a number of criteria (e.g.
location, contract, date modified, etc). Other than modified date, all my
filters are selected via combo boxes. I would like to have the combo boxes
update so that if there are no items available in the currently filtered
list for a given selection, that selection will not appear in the...
|
by: Mike Wilson |
last post by:
Dear Group,
I have a heirarchical set of database tables, say - "order" and "order_type"
and want to display a series of orders in a grid control, and in place of
the order_type foreign key identifier, I would like a dropdown combo box
(lookup from the "order_type" table) to change the type of the order. I also
need an update command button, a delete row button and also an insert new
row button.
I'm sure this is a very common design...
| |
by: =?Utf-8?B?UmljaA==?= |
last post by:
Greetings,
I have to load 30,000 unique names into a combox. Filling a dataTable takes
only a few milliseconds. But populating the combobox and displaying the list
takes several seconds - way too long. A user selects a name from the
combobox and runs a query.
Originally, this combox was on a form in an MS Access ADP which was linked
directly to our sql server. The combobox populated withins millisecnods.
How can I achieve this...
|
by: StefanPienaar |
last post by:
Hi Guys
Is there any way in c# (or vb.net) to extract a datatable of data from a dataset with multiple datatables which has relationships set up (containing combined data from the datatables)?
I currently have 2 datatables in the dataset. The first one contains the header records with columns such as Id, DateCreated, DateModified, etc
The second datatable contains the detail records and has columns such as Id, BatchId (which links to...
|
by: =?Utf-8?B?anAybXNmdA==?= |
last post by:
In Visual Studio 2005, I have my DataSet filled with several static tables
(they might get changed weekly, but that's about it).
With one of these tables in the DataSet, is it possible to select distinct
items?
Ex:
I want to fill a tree with a list of job titles, and the Employee table
isalready filled with all of our employee records. Is there a way I could do
something like this below?
|
by: hollyquinn |
last post by:
Hi I am working with a web application where I am selecting values from a SQL Server 2005 database and then loading the values into different controls on my page. Most of the values load with no problem, except for those columns where the value of the selected row in the column could be a null. I get the following error message:
The value for column 'COLUMN NAME' in table 'TABLE NAME' is DBNull.
I've tried in my Sql select statement to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |