473,785 Members | 2,938 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Searching Database - Design Best Practices

Hi All,
i have a sit which deals with cars, and i have a table
associated with this, i do have a problem in designing the
application, i have lot of places in the web page where it hits the
the same table but the criteria (parameters) will be different,

Can some body help me out in designing a class which suits the above
purpose , or sugggest me Best Practices for the same

Thanks in advance

thomson

Nov 13 '07 #1
2 1180
Mmmm....

It can more complicated but... maybe this simple approach can feed your
needs: Create an stored procedure with all the search params that you need,
set the default value of each param to NULL.

Now in the select where you filter use this approach (pseudo SQL here):

DECLARE My Store Proc
MyParam1 Int = NULL,
MyPAram2 varchar(80) = NULL,
(...)

SELECT ...
FROM ...
WHERE
(MyParam1 IS NULL OR tablefield1 = MyParam1)
AND
(MyParam2 IS NULL OR tablefield1 = MyParam2)

By using this approach you control if the param has been informed using
the IS NULL and the OR switch, and you avoid having chunking T-SQL IF
statements.

/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------


"thomson" wrote:
Hi All,
i have a sit which deals with cars, and i have a table
associated with this, i do have a problem in designing the
application, i have lot of places in the web page where it hits the
the same table but the criteria (parameters) will be different,

Can some body help me out in designing a class which suits the above
purpose , or sugggest me Best Practices for the same

Thanks in advance

thomson

Nov 13 '07 #2
You can read my take on the issue here:
http://www.sqlservercentral.com/arti...rproblem/2283/


"thomson" <sa**********@y ahoo.comwrote in message
news:11******** **************@ q5g2000prf.goog legroups.com...
Hi All,
i have a sit which deals with cars, and i have a table
associated with this, i do have a problem in designing the
application, i have lot of places in the web page where it hits the
the same table but the criteria (parameters) will be different,

Can some body help me out in designing a class which suits the above
purpose , or sugggest me Best Practices for the same

Thanks in advance

thomson

Nov 13 '07 #3

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

Similar topics

5
13966
by: Chris | last post by:
Having been traumatised many years ago when using MFC/C++ to develop front-end code, I've religiously avoided GUI work since and stuck to back-end / server-side projects. So I'm a bit of a novice when it comes to designing Swing-based applications. I'm now having to do more and more GUI work to support my current projects, so I started looking for tutorial / best-practices materials on the net. I was somewhat surprised to find that...
2
1530
by: hplloyd | last post by:
I am fairly new to VB.NET programming but have built many database applications in Access SQL Server etc. I need to find a good book or other reference material that will help me take my OO programing skills to the next level. I can build forms and bind data to them from SQL server, but somehow this seems not to be the best way to use an OO programming language. I guess the professional way of doing it is to have classes for each of the...
346
16645
by: rkusenet | last post by:
http://biz.yahoo.com/rc/040526/tech_database_marketshare_1.html Interesting to see that database sales for windows is more than Unix.
4
1846
by: Luis Esteban Valencia | last post by:
Hello. Can somebody recomend me books of design patterns in c# and best practices too.
4
2631
by: Collin Peters | last post by:
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the simplest example of my situation (real world would be more complex). Say you have two versions of your application. A release version and a development version. After a month of developing you are ready to release a new version. There have...
4
2986
by: DeepDiver | last post by:
I am developing an inventory database in SQL Server. I realize there are many commercial (as well as some non-commercial) inventory offerings, but my client has specific requirements that would necessitate significant customization of any off-the-shelf application. In the end, we decided it would be more feasible to build one to our specifications. What I am looking for are a list of best practices/recommendations for the architecture...
8
2763
by: situ | last post by:
Hello all, i have Database1 and database2, is it possible to make database connection to database2 by running stored procedure on database1. Thanks and Regards Situ
9
1707
by: Yehia A.Salam | last post by:
Hello, I am building an ASP.net website that connects to an XML database, and was wondering which is the best way to create the connection if I need frequent access to the database, I have one of the three options: 1. Use one instance of XmlDocument thought the whole Application by initializing the class in Global.asax in the Application_Start Event. 2. Use one instance per session using the Session_Start Event. 3. Create and...
12
7020
by: nyathancha | last post by:
Hi, I have a question regarding best practices in database design. In a relational database, is it wise/necessary to sometimes create tables that are not related to other tables through a foreign Key relationship or does this always indicate some sort of underlying design flaw. Something that requires a re evaluation of the problem domain? The reason I ask is because in our application, the user can perform x
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9952
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8976
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
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 we have to send another system
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.