views:

253

answers:

2

I have an Oracle DB, and an ASP Page that has many ListBoxes and DropDownLists. These controls make the user input data to get filtered results on the next page.

Once the user clicks search, a string (query) is generated based on the selections of the user. The results page has a datagrid that takes this string and uses it to get data for the grid from the database.

Also, I want to use a separate class with methods to create the string.

My datagrid is working fine with queries that I type on my own, but what I need is a class to generate that query using all the user input.

What would be the best approach? (I am using ASP.NET 2.0 and C#)

+1  A: 

For such a broad question you're going to require multiple sets of information.

You'll want to start by hooking into your Oracle database and making the query (Step 1). The next step is to display the results on your forms (Step 2). Once you've got that working, you can start parameterizing your queries (Step 3). Here is a collection of topics to get you started. You ought to be able to piece things together from there.

Step 1 :: Conntecting to an Oracle DB in ASP.NET
Step 2 :: ASP.NET GridView Databinding
Step 3 :: Parameterized Queries

Gavin Miller
A: 

We've done similar things in that we have a massive Criteria page where the user can pick from ~400 points of data. Then we use all that data to formulate some kind of query into the database. We found it very useful to roll all that Criteria data into a serializable structure, we used a complex object that could serialize to xml. It made testing that whole system a thousand times easier. It also opened the door for us to add saved searches to the system.

Use a separate class for the Transform-Object-To-Sql code.

Al W