PC Review


Reply
Thread Tools Rate Thread

Best way to handle multi field queries

 
 
Bill Gower
Guest
Posts: n/a
 
      27th Sep 2007
I am currently reevaluating how I do look ups and searches. What is the
best method for handling forms where user can search by different criteria.
Example, A member form allows users to look up a member by either SSN,
Lastname + firstname (whole or partial), all active or inactive or by an
office. Should I have multiple Get Methods such as

GetMemberBySSN()
GetMemberByMemberName()
GerMemberByOffice()
GetMemberByStatus()
GetMemberByStatusOffice()

or

GetMemberWithCriteria(string criteria) and then append the criteria string
to a WHERE clause.

Bill


 
Reply With Quote
 
 
 
 
Robbe Morris - [MVP] C#
Guest
Posts: n/a
 
      28th Sep 2007
Definitely option #1. You don't want people passing in strings
that you are going to append to dynamic sql. Big security risk.

Plus, you want a structured and "obvious" set of methods for
other developers to look at whether you are the only developer
or not. Noone would know how to properly format "criteria"
in option #2.

--
Robbe Morris [Microsoft MVP - Visual C#]
..NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
http://www.eggheadcafe.com/tutorials...d-control.aspx




"Bill Gower" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am currently reevaluating how I do look ups and searches. What is the
>best method for handling forms where user can search by different criteria.
>Example, A member form allows users to look up a member by either SSN,
>Lastname + firstname (whole or partial), all active or inactive or by an
>office. Should I have multiple Get Methods such as
>
> GetMemberBySSN()
> GetMemberByMemberName()
> GerMemberByOffice()
> GetMemberByStatus()
> GetMemberByStatusOffice()
>
> or
>
> GetMemberWithCriteria(string criteria) and then append the criteria string
> to a WHERE clause.
>
> Bill
>
>


 
Reply With Quote
 
William Vaughn
Guest
Posts: n/a
 
      30th Sep 2007
I agree with Robbe. Simpler SPs build better, more efficient (faster
running) query plans.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Robbe Morris - [MVP] C#" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Definitely option #1. You don't want people passing in strings
> that you are going to append to dynamic sql. Big security risk.
>
> Plus, you want a structured and "obvious" set of methods for
> other developers to look at whether you are the only developer
> or not. Noone would know how to properly format "criteria"
> in option #2.
>
> --
> Robbe Morris [Microsoft MVP - Visual C#]
> .NET PropertyGrid Control - ListBox, ComboBox, and Custom Classes
> http://www.eggheadcafe.com/tutorials...d-control.aspx
>
>
>
>
> "Bill Gower" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I am currently reevaluating how I do look ups and searches. What is the
>>best method for handling forms where user can search by different
>>criteria. Example, A member form allows users to look up a member by
>>either SSN, Lastname + firstname (whole or partial), all active or
>>inactive or by an office. Should I have multiple Get Methods such as
>>
>> GetMemberBySSN()
>> GetMemberByMemberName()
>> GerMemberByOffice()
>> GetMemberByStatus()
>> GetMemberByStatusOffice()
>>
>> or
>>
>> GetMemberWithCriteria(string criteria) and then append the criteria
>> string to a WHERE clause.
>>
>> Bill
>>
>>

>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can XP Pro handle Multi-Processor? HotRod Windows XP General 7 8th Dec 2005 05:50 PM
Best way to handle multi-user environment Aaron Smith Microsoft VB .NET 10 1st Dec 2004 01:45 PM
how to handle empty fields in queries Christopher Glaeser Microsoft Access Queries 2 25th Nov 2004 08:52 AM
multi-field queries Bill Stone Microsoft Access Queries 1 16th May 2004 02:28 PM
How to handle sql queries Mikael Janers Microsoft C# .NET 3 22nd Aug 2003 10:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:54 AM.