Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Access Database Value Retrieval

Reply
Thread Tools

Access Database Value Retrieval

 
 
Sparky Arbuckle
Guest
Posts: n/a
 
      06-03-2005
I have the following sql statement, typically it would grab a specific
value but I also want to be able to grab all values within the
database. Can I use the same SQL statement? I thought I could just use
* and pull everything but that doesn't appear to work.

SELECT tblRacers.RacerID, tblRacers.strLName, tblRacers.strFName,
tblRacers.strAgeCat, tblRacers.strRaceCat FROM tblRacers WHERE
tblRacers.strAgeCat='" & strAgeCat & "' AND tblRacers.strRaceCat='" &
strRaceCat & "';

I thought if the value passed in for strAgeCat/strRaceCat was * it
would pull all but I guess that isn't the case. Any suggestions on how
to approach this?

Thanks!

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmhhdmVzaCBQYXRlbA==?=
Guest
Posts: n/a
 
      06-03-2005
Hello

I don't know what you are stored in strAgeCat but you can form your query
like this.

SELECT tblRacers.RacerID, tblRacers.strLName, tblRacers.strFName,
tblRacers.strAgeCat, tblRacers.strRaceCat FROM tblRacers WHERE
tblRacers.strAgeCat like '% " & strAgeCat & "%' AND tblRacers.strRaceCat
like '%" &
strRaceCat & "'%" ;

However this is not the proper solution but we can fetch all the records
from the database not setting the value of strAgeCat/strRaceCat. I mean in
the absense of the values the query we shall have tblRacers.strAgeCat like
'%%' and so will get all the records.

I think it may work for you.

regards,
Bhavesh Patel


"Sparky Arbuckle" wrote:

> I have the following sql statement, typically it would grab a specific
> value but I also want to be able to grab all values within the
> database. Can I use the same SQL statement? I thought I could just use
> * and pull everything but that doesn't appear to work.
>
> SELECT tblRacers.RacerID, tblRacers.strLName, tblRacers.strFName,
> tblRacers.strAgeCat, tblRacers.strRaceCat FROM tblRacers WHERE
> tblRacers.strAgeCat='" & strAgeCat & "' AND tblRacers.strRaceCat='" &
> strRaceCat & "';
>
> I thought if the value passed in for strAgeCat/strRaceCat was * it
> would pull all but I guess that isn't the case. Any suggestions on how
> to approach this?
>
> Thanks!
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Random record retrieval from database Subashini Kumar Ruby 1 09-23-2009 06:22 AM
textbox retrieval from sql server database ArtySin ASP .Net Datagrid Control 0 12-02-2006 12:43 AM
Re: HTML Form value retrieval Rick Spiewak ASP .Net 1 05-07-2004 04:36 PM



Advertisments