"DavidB" <d9*******@cairns.qld.gov.au> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
New to .net....sorry if this seems repetitive
I have a dataset ordered by date (SQLDataAdapter SelectCommand uses
Order By) and want to find a record by a UniqueID(Identity Column).
Then I want to change the position (BindingContext) in the dataset to
have all my bound controls reflect the data in the found record - and
the related records/tables.
Problem is, it appears it can't be done....
The Dataset has to be ordered by the date column, and the UniqeID (int)
is the primary key.
The solution of creating a Dataview and finding the record is not a
real-world solution as it requires the sort order to be changed (from
date to identity column). Hence the index of the found item is unlikely
to be correct.
I think many people have travelled this path before but I can't find
any useful info relating to this exact issue
If you can help, please do..
DB
In your SQL statement, you can select only the row(s) that have the UniqueID
you are looking for pretty easy.
Something similar to this:
" Select * From <tablename goes here> Where [ColumnName goes here] = " &
UniqueIDvalue & " Order By [Date]"
<tablename goes here> is the name of the table you are searching in ( just
put the table name not the < >.
ColumnName goes here is the name of the Column that contains the
UniqueIDvale that you are looking for.( keep the brackets)
UniqueIDvalue can be a string that contains the value you are searching for.
I think you get the idea here. You select all of the table's columns and
search for only the row(s) that have the value you are looking for in a
particular column. Or if you only need a few of the table's columns, you
can modify the Select portion of the statement similar to :
"Select [column1], [column2], [column3], [column4] Where [Column3] =" &
UnidueIDvalue & " Order By [column1]"
Hope this is what you are looking for.
james