Parameters using the DataSet object ?

  • Thread starter Thread starter omar
  • Start date Start date
O

omar

I know how to use parameters with SQL stored in an OledbCommand object but
is it possible to use parameters when using the DataSet object since it
doesnt use the OledbCommand object? If so can give a small example or link.

for example if i want to filter a table stored in a dataset with 2
parameters entered through a form on the page...

thank you
omar
 
omar

To create a customised view of a DataTable, use a DataView and set the
RowFilter
eg (if your DataTable is call myTable and it contains a DataColumn named
Country)
dim myView as DataView = myTable.DefaultView
myView.RowFilter = "Country = 'Australia'" 'Shows only records where the
country is Australia
You will need to get the value from your TextBoxes and build your own filter
string

Stephen
 
omar

You can filter on as many columns as you want but you need to combine them
into one filter string (you can only apply one RowFilter)

eg. myRowFilter = "Country = 'Australia' AND UserID = 2"

It is essentially a SQL WHERE clause but without the "WHERE". Note that
strings are surrounded by single quote (Country = 'Australia'), but numeric
data is not (UserID = 2)
I suggest you search help for DataView.

Stephen
 
Back
Top