473,473 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

selecting data in database with different queries

hi

asp.net 2.0
sql server 2005

I have a GridView on my webpage. Sometimes I want to query the bound
datasource in different ways.:
- Get all arroved records
- Get all unapproved records
- Get all records created last week
- Get all records created by current user.
- Get top 100 records (return 100 records)

this is a standard table in a database on sqlserver 2005. primary key is
uniqueidentifier

Hope there are a better way of doing this than creating multiple stored
procedures....

any suggestions?
Oct 13 '08 #1
3 1124
If the where clause is the only thing changing, then look here:
http://www.sqlservercentral.com/arti...rproblem/2283/

The "TOP 100", I would isolate.

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:ev**************@TK2MSFTNGP05.phx.gbl...
hi

asp.net 2.0
sql server 2005

I have a GridView on my webpage. Sometimes I want to query the bound
datasource in different ways.:
- Get all arroved records
- Get all unapproved records
- Get all records created last week
- Get all records created by current user.
- Get top 100 records (return 100 records)

this is a standard table in a database on sqlserver 2005. primary key is
uniqueidentifier

Hope there are a better way of doing this than creating multiple stored
procedures....

any suggestions?

Oct 14 '08 #2
Thanks for that link.

But now I'm wondering if there is another possible approach. The thing is
that my DAL creates a collection of the objects.
for example List<carcars = siteprovider.getCars();

So maybe a possible workaround to using xml parameter is to in the
application start event put some logic that reads in the entire collection
of cars and then store it the cache. And then use the search mecanism on the
list (List<car>) to get the cars I want. In that approach I don't need to
make another trip to the database.

One issue I see is that perhaps sometime the cache will be lost, but then
maybe make a new trip to the database and return all the records. Then store
it in cache etc...

any suggestons? problem using this approach?
Oct 15 '08 #3

Sure.

"workaround to xml parameter"
Why would you fear using xml? Sql Server does a nice job of shredding them.

But you can put the data into cached object.

However, it dependings on how many optional filters you need to code.
If you have alot, it won't be trivial.

I would research the "Filter" using Ludwig's very good article:
http://www.scribd.com/doc/2057557/CTG-Articles-Generics

I foresee a maze of Filter methods......but maybe you can figure out
something.

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uU****************@TK2MSFTNGP02.phx.gbl...
Thanks for that link.

But now I'm wondering if there is another possible approach. The thing is
that my DAL creates a collection of the objects.
for example List<carcars = siteprovider.getCars();

So maybe a possible workaround to using xml parameter is to in the
application start event put some logic that reads in the entire collection
of cars and then store it the cache. And then use the search mecanism on
the list (List<car>) to get the cars I want. In that approach I don't need
to make another trip to the database.

One issue I see is that perhaps sometime the cache will be lost, but then
maybe make a new trip to the database and return all the records. Then
store it in cache etc...

any suggestons? problem using this approach?

Oct 15 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Frnak McKenney | last post by:
Back when computer dinosaurs roamed the earth and the precursors to today's Internet were tiny flocks of TDMs living symbiotically with the silicon giants, tracking access to data processing...
19
by: Ben Gribaudo | last post by:
Hello! I am trying to query a MySQL table and retrieve either the earliest or the latest message in each thread. The messages are in a table with MsgID being the primary key and fThreadID...
5
by: charlies224 | last post by:
Hi, I am using SQL 2000 and has a table that contains more than 2 million rows of data (and growing). Right now, I have encountered 2 problems: 1) Sometimes, when I try to query against this...
2
by: Greg Strong | last post by:
Hello All, I've written code in a test database with test data. Everything seems to be working except compact database in VB code per http://www.mvps.org/access/general/gen0041.htm. The reason I...
6
by: aaj | last post by:
Hi all I use a data adapter to read numerous tables in to a dataset. The dataset holds tables which in turn holds full details of the records i.e. keys, extra colums etc.. In some cases I...
0
by: Christoph Haas | last post by:
Hi, list... I have written an application in Perl some time ago (I was young and needed the money) that parses multiple large text files containing nested data structures and allows the user to...
6
by: rdemyan via AccessMonster.com | last post by:
I don't understand why I can get the following to work: ------------------------------------------------------------------------------ -- SELECT A.*, B.* FROM TableA AS A, TableA AS B IN...
2
by: larry | last post by:
I am working on a DB for family data, and in this application the data spans variable amount of rows in multiple tables (one for the adults data, one for "family", one for the kids, another for...
5
MattFitzgerald
by: MattFitzgerald | last post by:
Can you help I want to reduce the number of queries I use? I have a union query which combines data from 2 different databases located at different sites. Both databases are identical each of...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.