Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Passing a database field value through the url


Message #1 by "Tim Rusten" <rustent@s...> on Mon, 3 Mar 2003 19:32:42
I am attempting to pass a MS Access database field value through the 
URL.  How it is supposed to work is when you click on the column heading 
it will resort the list.  The problem I am running into is when the field 
value has a space in it.  If there is a space it will not give the whole 
value.  For example, this is a line of code that I am using:

<TD WIDTH=25%><A HREF=ScheduledEventSearchProc.asp?Description=<% = 
EDescription %>&Detail=<% = EDetail %>&Type=<% = EType %> 
&sort=Title><B>Description</B></a></TD>

If the value of any of these fields has a space in it, it will not give 
me the whole value.  For example, if the value for EType is Health 
Events, only the word Health is passed through the URL not Health Events 
and nothing else after it is passed at all. When that space is there 
everything else is dropped off the end. This is what is currently 
happening.

/ScheduledEventSearchProc.asp?Description=&Detail=&Type=Health

and this is what I would like to happen.

/ScheduledEventSearchProc.asp?Description=&Detail=&Type=Health 
Events&sort=DateTime

 If hope that this makes sense and I will gladly explain it in more 
detail if needed.  Any help would be greatly appreciated.  Thanks for 
your time.
Message #2 by "wayne wanless" <wanless@n...> on Mon, 3 Mar 2003 20:23:11
Tim,
Please give a little more detail regarding your application...

The command Server.URLEncode can be used to pass a URL from one ASP page 
to another. This command replaces blank spaces with the (+) charactor.

Another approach would be to replace the blank spaces with symbols through 
an ASP statement prior to passing the variable info to the URL:

sEType = Replace(sEType, " ", "+")

and then

sEType = Replace(sEType, "+", " ")

ww




> I am attempting to pass a MS Access database field value through the 
U> RL.  How it is supposed to work is when you click on the column heading 
i> t will resort the list.  The problem I am running into is when the 
field 
v> alue has a space in it.  If there is a space it will not give the whole 
v> alue.  For example, this is a line of code that I am using:

> <TD WIDTH=25%><A HREF=ScheduledEventSearchProc.asp?Description=<% = 
E> Description %>&Detail=<% = EDetail %>&Type=<% = EType %> 
&> sort=Title><B>Description</B></a></TD>

> If the value of any of these fields has a space in it, it will not give 
m> e the whole value.  For example, if the value for EType is Health 
E> vents, only the word Health is passed through the URL not Health Events 
a> nd nothing else after it is passed at all. When that space is there 
e> verything else is dropped off the end. This is what is currently 
h> appening.

> /ScheduledEventSearchProc.asp?Description=&Detail=&Type=Health

> and this is what I would like to happen.

> /ScheduledEventSearchProc.asp?Description=&Detail=&Type=Health 
E> vents&sort=DateTime

>  If hope that this makes sense and I will gladly explain it in more 
d> etail if needed.  Any help would be greatly appreciated.  Thanks for 
y> our time.
Message #3 by "Tim Rusten" <rustent@s...> on Mon, 3 Mar 2003 22:36:18
Wayne,
  Thanks for the response.  The replace function worked like a charm.  I 
really appreciate your help. Have a great day!!

Tim

> Tim,
P> lease give a little more detail regarding your application...

> The command Server.URLEncode can be used to pass a URL from one ASP 
page 
t> o another. This command replaces blank spaces with the (+) charactor.

> Another approach would be to replace the blank spaces with symbols 
through 
a> n ASP statement prior to passing the variable info to the URL:

> sEType = Replace(sEType, " ", "+")

> and then

> sEType = Replace(sEType, "+", " ")

> ww

> 

> 

  Return to Index