data view query

  • Thread starter Thread starter tarun.sinha
  • Start date Start date
T

tarun.sinha

Hello All..

I Need Your Help,
I want to set a filter in data set.I am fetching the data from store
Procedure in dataset,
but I want to use data view to filter this data set.how do i do it,
Please consider my poor
Knowledge and reply me.I have search a lot in google but I am unable to
use it.
Let me Clear you the picture again,

dataset = call store procedure()
this data set include the information about username , now i want to
fetch only
those user from dataset whose name is start from alphabet 'P'.

How do I do that ??

Tarun
 
Tarun,

First of all, the dataset is a wrapper which holds datatables and
datarelations. To do selections you need to use the tables.

By instance written in VB
ds.Tables(0) is the first table while it is in C# ds.Tables[0]

The dataview is well described.
http://msdn.microsoft.com/library/d...rlrfsystemdatadataviewclassrowfiltertopic.asp

Therefore someting as

ds.tables(0).Defaultview.rowfilter = "SUBSTRING(MyUserColumn, 0, 1) = " &
TheCharIWantToSelect

The defaultview is the inbuild dataview, to create extra dataviews you can
use

dim dv as new dataview(ds.tables(0))

I hope this helps,

Cor
 
Back
Top