Ask a Question related to ASP Database, Design and Development.
-
RH #1
QueryString query
If Request.QueryString("StartLName") <> "" Then
RecordToEdit = Request.QueryString("MemID")
SQL = "SELECT * FROM member WHERE (LName Like
'"&request.querystring("StartLName")&"');"
End If
<a href='listMemberSpec.asp?StartLName="A"'>A</A>
I have this code (above), and I'd like to pass a letter (IE A) to StartLName
with the * (Access DB) to retrieve all the Last Name records in the database
that start with A
Can anyone tell me please what part of the code I need to change in order to
do this please?
TIA
RH Guest
-
QueryString Length
method=post doesn't use the querystring. Your querystring length will be 0, unless you've put something your form action, like... -
QueryString MAx Length
All, How can I find the Max length of the QueryString? I am passing data between ASP pages and use the Response.QueryString (I know that this is... -
how to pass an access DB query onto *next* page? trouble with *next* and *previous* querystring code
Don;t see any sign of any paging code is your snippets normally take this form Set rso = Server.CreateObject("ADODB.Recordset") rso.PageSize =... -
querystring question
"Gonzosez" wrote ... I dont think you need to, I believe that its only whilst the info travels through cyberspace and arrives at its... -
Pack QueryString
I've got a (probably) long list of data which I want to send to an ASPX page by query string. To keep the URL short and compact I want to compress... -
Bob Barrows #2
Re: QueryString query
RH wrote:
Use a wildcard:> If Request.QueryString("StartLName") <> "" Then
> RecordToEdit = Request.QueryString("MemID")
> SQL = "SELECT * FROM member WHERE (LName Like
> '"&request.querystring("StartLName")&"');"
> End If
>
> <a href='listMemberSpec.asp?StartLName="A"'>A</A>
>
> I have this code (above), and I'd like to pass a letter (IE A) to
> StartLName with the * (Access DB) to retrieve all the Last Name
> records in the database that start with A
>
> Can anyone tell me please what part of the code I need to change in
> order to do this please?
>
> TIA
" ... WHERE (LName Like '" & _
request.querystring("StartLName") & "%');"
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
RH #3
Re: QueryString query
Hi Bob - thanks - but this doesn't seem to work.
Is this the right wildcard for an Access 2003 DB?
Robyn
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
news:OVIivLQ9DHA.3012@TK2MSFTNGP09.phx.gbl...> RH wrote:>> > If Request.QueryString("StartLName") <> "" Then
> > RecordToEdit = Request.QueryString("MemID")
> > SQL = "SELECT * FROM member WHERE (LName Like
> > '"&request.querystring("StartLName")&"');"
> > End If
> >
> > <a href='listMemberSpec.asp?StartLName="A"'>A</A>
> >
> > I have this code (above), and I'd like to pass a letter (IE A) to
> > StartLName with the * (Access DB) to retrieve all the Last Name
> > records in the database that start with A
> >
> > Can anyone tell me please what part of the code I need to change in
> > order to do this please?
> >
> > TIA
> Use a wildcard:
>
>
> " ... WHERE (LName Like '" & _
> request.querystring("StartLName") & "%');"
>
> Bob Barrows
>
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
RH Guest
-
RH #4
Re: QueryString query
I added this :
WHERE (LName Like '" & request.querystring("StartLName") & "%');"
and this comes up
listMemberSpec.asp?StartLName="A"
How do I get the % next to the A?
R
"RH" <rh@rh.com> wrote in message
news:ee8w$RQ9DHA.2412@TK2MSFTNGP09.phx.gbl...> Hi Bob - thanks - but this doesn't seem to work.
> Is this the right wildcard for an Access 2003 DB?
>
> Robyn
>
>
> "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:OVIivLQ9DHA.3012@TK2MSFTNGP09.phx.gbl...>> > RH wrote:> >> > > If Request.QueryString("StartLName") <> "" Then
> > > RecordToEdit = Request.QueryString("MemID")
> > > SQL = "SELECT * FROM member WHERE (LName Like
> > > '"&request.querystring("StartLName")&"');"
> > > End If
> > >
> > > <a href='listMemberSpec.asp?StartLName="A"'>A</A>
> > >
> > > I have this code (above), and I'd like to pass a letter (IE A) to
> > > StartLName with the * (Access DB) to retrieve all the Last Name
> > > records in the database that start with A
> > >
> > > Can anyone tell me please what part of the code I need to change in
> > > order to do this please?
> > >
> > > TIA
> > Use a wildcard:
> >
> >
> > " ... WHERE (LName Like '" & _
> > request.querystring("StartLName") & "%');"
> >
> > Bob Barrows
> >
> >
> > --
> > Microsoft MVP - ASP/ASP.NET
> > Please reply to the newsgroup. This email account is my spam trap so I
> > don't check it very often. If you must reply off-line, then remove the
> > "NO SPAM"
> >
> >
>
RH Guest
-
Bob Barrows #5
Re: QueryString query
What does "doesn't seem to work" mean? Error message? Incorrect result?
Print out your sql statement:
Response.Write SQL
and make sure it's correct.
FWIW, if you created the query in Access, you would use * for the wildcard.
But when you build and run the query via ADO, you have to use the ODBC
wildcard: %
RH wrote:> Hi Bob - thanks - but this doesn't seem to work.
> Is this the right wildcard for an Access 2003 DB?
>
> Robyn
>
>
> "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:OVIivLQ9DHA.3012@TK2MSFTNGP09.phx.gbl...>> RH wrote:>>>>> If Request.QueryString("StartLName") <> "" Then
>>> RecordToEdit = Request.QueryString("MemID")
>>> SQL = "SELECT * FROM member WHERE (LName Like
>>> '"&request.querystring("StartLName")&"');"
>>> End If
>>>
>>> <a href='listMemberSpec.asp?StartLName="A"'>A</A>
>>>
>>> I have this code (above), and I'd like to pass a letter (IE A) to
>>> StartLName with the * (Access DB) to retrieve all the Last Name
>>> records in the database that start with A
>>>
>>> Can anyone tell me please what part of the code I need to change in
>>> order to do this please?
>>>
>>> TIA
>> Use a wildcard:
>>
>>
>> " ... WHERE (LName Like '" & _
>> request.querystring("StartLName") & "%');"
>>
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
Bob Barrows #6
Re: QueryString query
RH wrote:
You don't. You pass the letter alone in the querystring. You append the % in> I added this :
> WHERE (LName Like '" & request.querystring("StartLName") & "%');"
> and this comes up
> listMemberSpec.asp?StartLName="A"
> How do I get the % next to the A?
> R
the statement where you build the query.
Wait a minute. Back up. Why do you want to put the % in the querystring?
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
RH #7
Re: QueryString query
Changed this:
WHERE (LName Like '" & request.querystring("StartLName") & "%');"
to this:
WHERE (LName Like '" & request.querystring("StartLName") & "*');"
SQL Statement comes out like this:
SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like '"A"*');
If I do this:
SQL = "SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like
'Rice');"
SQL statement comes out as:
SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like 'Rice');
and Rice, Terri is displayed.
But if I want all the records starting with R and do this
SQL = "SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like
'R*');"
SQL statement comes out as:
SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like 'R*');
and no records are displayed - agggggg
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
news:OfRUkXQ9DHA.3364@TK2MSFTNGP09.phx.gbl...wildcard.> What does "doesn't seem to work" mean? Error message? Incorrect result?
>
> Print out your sql statement:
>
> Response.Write SQL
>
> and make sure it's correct.
>
> FWIW, if you created the query in Access, you would use * for the> But when you build and run the query via ADO, you have to use the ODBC
> wildcard: %
>
> RH wrote:>> > Hi Bob - thanks - but this doesn't seem to work.
> > Is this the right wildcard for an Access 2003 DB?
> >
> > Robyn
> >
> >
> > "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
> > news:OVIivLQ9DHA.3012@TK2MSFTNGP09.phx.gbl...> >> RH wrote:
> >>> If Request.QueryString("StartLName") <> "" Then
> >>> RecordToEdit = Request.QueryString("MemID")
> >>> SQL = "SELECT * FROM member WHERE (LName Like
> >>> '"&request.querystring("StartLName")&"');"
> >>> End If
> >>>
> >>> <a href='listMemberSpec.asp?StartLName="A"'>A</A>
> >>>
> >>> I have this code (above), and I'd like to pass a letter (IE A) to
> >>> StartLName with the * (Access DB) to retrieve all the Last Name
> >>> records in the database that start with A
> >>>
> >>> Can anyone tell me please what part of the code I need to change in
> >>> order to do this please?
> >>>
> >>> TIA
> >>
> >> Use a wildcard:
> >>
> >>
> >> " ... WHERE (LName Like '" & _
> >> request.querystring("StartLName") & "%');"
> >>
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
RH Guest
-
Bob Barrows #8
Re: QueryString query
RH wrote:
Why???> Changed this:
> WHERE (LName Like '" & request.querystring("StartLName") & "%');"
> to this:
> WHERE (LName Like '" & request.querystring("StartLName") & "*');"
That's not right. You got this from a Response.Write?>
> SQL Statement comes out like this:
> SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like
> '"A"*');
If request.querystring("StartLName") contains only the letter R, I would
expect your above statement to result in:
SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like
'A*');
But that's neither here nor there. This is the statement you should be
striving for:
SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like
'A%');
As expected.>
> If I do this:
> SQL = "SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName
> Like 'Rice');"
> SQL statement comes out as:
> SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like
> 'Rice'); and Rice, Terri is displayed.
They're not supposed to! * is not a wildcard when running a query from ADO:>
> But if I want all the records starting with R and do this
> SQL = "SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName
> Like 'R*');"
> SQL statement comes out as:
> SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like
> 'R*');
>
> and no records are displayed - agggggg
>
it's a literal character. You're query is not finding any records where
LName contains only the two characters R and *.
Again. The % is the wildcard you need to use in ADO. Why are you ignoring
this?
SQL = "SELECT MemID, Chapter, Lname, Fname " & _
"FROM member WHERE LName Like 'R%'"
If you opened your database in Access and create a query, you would need to
use the * as the wildcard. But when you create and run the query from ADO,
you need to use %. I don't know how I can say this any plainer ...
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
RH #9
Re: QueryString query
Ok - I figured it out - the problem was with the
<a href='listMemberSpec.asp?StartLName="A"'>A</A>
s/b <a href='listMemberSpec.asp?StartLName=A'>A</A>
Thanks for all your help!!!
Robyn
"RH" <rh@rh.com> wrote in message
news:OY7XigQ9DHA.1636@TK2MSFTNGP12.phx.gbl...> Changed this:
> WHERE (LName Like '" & request.querystring("StartLName") & "%');"
> to this:
> WHERE (LName Like '" & request.querystring("StartLName") & "*');"
>
> SQL Statement comes out like this:
> SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like '"A"*');
>
> If I do this:
> SQL = "SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like
> 'Rice');"
> SQL statement comes out as:
> SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like 'Rice');
> and Rice, Terri is displayed.
>
> But if I want all the records starting with R and do this
> SQL = "SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like
> 'R*');"
> SQL statement comes out as:
> SELECT MemID, Chapter, Lname, Fname FROM member WHERE (LName Like 'R*');
>
> and no records are displayed - agggggg
>
>
>
> "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:OfRUkXQ9DHA.3364@TK2MSFTNGP09.phx.gbl...> wildcard.> > What does "doesn't seem to work" mean? Error message? Incorrect result?
> >
> > Print out your sql statement:
> >
> > Response.Write SQL
> >
> > and make sure it's correct.
> >
> > FWIW, if you created the query in Access, you would use * for the>> > But when you build and run the query via ADO, you have to use the ODBC
> > wildcard: %
> >
> > RH wrote:> >> > > Hi Bob - thanks - but this doesn't seem to work.
> > > Is this the right wildcard for an Access 2003 DB?
> > >
> > > Robyn
> > >
> > >
> > > "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
> > > news:OVIivLQ9DHA.3012@TK2MSFTNGP09.phx.gbl...
> > >> RH wrote:
> > >>> If Request.QueryString("StartLName") <> "" Then
> > >>> RecordToEdit = Request.QueryString("MemID")
> > >>> SQL = "SELECT * FROM member WHERE (LName Like
> > >>> '"&request.querystring("StartLName")&"');"
> > >>> End If
> > >>>
> > >>> <a href='listMemberSpec.asp?StartLName="A"'>A</A>
> > >>>
> > >>> I have this code (above), and I'd like to pass a letter (IE A) to
> > >>> StartLName with the * (Access DB) to retrieve all the Last Name
> > >>> records in the database that start with A
> > >>>
> > >>> Can anyone tell me please what part of the code I need to change in
> > >>> order to do this please?
> > >>>
> > >>> TIA
> > >>
> > >> Use a wildcard:
> > >>
> > >>
> > >> " ... WHERE (LName Like '" & _
> > >> request.querystring("StartLName") & "%');"
> > >>
> >
> > --
> > Microsoft MVP - ASP/ASP.NET
> > Please reply to the newsgroup. This email account is my spam trap so I
> > don't check it very often. If you must reply off-line, then remove the
> > "NO SPAM"
> >
> >
>
RH Guest



Reply With Quote

