ldehart Posted October 13, 2003 Posted October 13, 2003 (for the purpose of this question, there are three columns in this table, 'Action_ID', 'Type_ID', 'Task_Parameter') I want to create a dataview where only those Action_ID's where type_id = 5 are going to be edited and compared. If multiple rows exist in this dataview where Type_ID = 5 and "Task_Parameter" is identical to any other row, then I only want to keep the row with the highest Action ID. Here is what I have so far Dim objConn As SqlConnection = New SqlConnection(Connection) Dim myActionCMD As SqlCommand = New SqlCommand("xxx" , objConn) Dim myActionDA As New SqlClient.SqlDataAdapter() Dim myActionDS As New DataSet() myActionDA.SelectCommand = myActionCMD myActionDS.Clear() myActionDA.Fill(myActionDS, "ActionTable") Dim sRowFilter As String = "Type_ID = 5" Dim sRowSort As String = "Action_ID" Dim dvCarepath As New DataView(myActionDS.Tables("ActionTable"), sRowFilter, sRowSort, DataViewRowState.ModifiedCurrent) any help on how to go about doing this is greatly appreciated. Quote
*Experts* Nerseus Posted October 13, 2003 *Experts* Posted October 13, 2003 Hmm... I don't know of any way to get the built-in DataView to limit rows to distinct rows. If you need this distinct view for binding purposes, I think you may have to go another route such as creating a new DataSet with the filtered data or use a custom binding object such as the JoinView. The JoinView is a new object that MS wrote, available through MSDN online for free, that shows how to implement a new DataView-like object. You can use it to bind to a JoinView object which would show two tables in a DataSet as one table for binding purposes (such as showing parent/child data in one row). If you have to go a custom route, at least there's that sample which shows how to create a bindable object. :p -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.