Parameters using the DataSet object ?

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
 
S

Stephen Muecke

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
 
S

Stephen Muecke

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top