Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a query on a DataSet or DataTable

Status
Not open for further replies.

TheDust

Programmer
Aug 12, 2002
217
US
I need to run a large amount of queries on one page to output formatted results scattered all over the page. Does anyone have an example of how to run a query on a DataSet already pulled from the database? I've been looking for information everywhere... some help is much needed and would be GREATLY appreciated.

Dust
 
Search the documentation for the .compute() method of the datatable.

That's your "in". If you get stuck with specific issues along the way, check back, and we'll work through them.

:)
paul

ps. it's a very very nice way to do things. ;-)
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
Q: how to avoid giving many similar queries to one DB ?
A: query DB once, and store the result in array,
further query just get answer from the array
 
I found what I needed... using a DataView with a RowFilter set to whatever I'd like to pull out... my only other question is how to use a DataReader to iterate through a DataView??? I want to print one column and use the other column in the URL for that item.
 
OK- here is a SPECIFIC problem for someone to tackle...

I am using a DataView with a row filter and usually this row filter is set to filter results that start with a specific letter:

clientsView.RowFilter = "clientName LIKE '" + indexLetter + "%'";

BUT the first time through I am attempting to select results that begin with a number, which I've done in the past with a SQL statement like this:

SELECT * FROM clients WHERE clientName REGEXP '^[^A-Za-z]'

So it made sense for me to apply this to a DataView's RowFilter like this:

clientsView.RowFilter = "clientName LIKE '" + indexLetter + "%'";

BUT I get this error:

Syntax error: Missing operand after 'REGEXP' operator

Any guesses??? Does ASP.NET not like certain strains of SQL?
 
SORRY... I typed out the ASP I am trying out...

clientsView.RowFilter = "clientName REGEXP '^[^A-Za-z]'";

There it is... Sorry... THIS is what is giving me the error stated above.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top