Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with DateTime value in <A href> </A> 1

Status
Not open for further replies.

clydejones

Programmer
Jan 11, 2001
153
US
Hey EveryBody,

I have an ASP page where I am getting a recordset and dynamically building a table. Everything works fine except the field I want to use as a link is a Datetime field. The only thing I get in the QueryString is the date not the whole DateTime Value.

Here is an example of the dateTime value:
1/7/2004 9:02:06 AM

and here is an example of the code I'm trying to use:

response.Write(&quot;<td><a href= Test.asp?Param1=&quot;&Session
(&quot;Param1&quot;)&&quot;&DateTime=&quot;&rsLoad.Fields(&quot;AppDate&quot;)&&quot;>&quot;&rsLoad.Fields(&quot;DateTimeField&quot;)&&quot;</a></td>

<td>&quot;&rsLoad.Fields(&quot;Field1&quot;)&&quot;, &quot;&rsLoad.Fields(&quot;Field2&quot;)&&quot;  &quot;&rsLoad.Fields(&quot;Field3&quot;)&&quot;</td><td>&quot;&rsLoad.Fields(&quot;Field4&quot;)&&quot;</td>&quot;)

I imagine the spaces between the year and time are killing me. I've tried using single quotes around rsLoad.Fields(&quot;AppDate&quot;), but only get '1/7/2004 in the QueryString. Any suggestions would be greatly appreciated.

Clyde
 
probably a formatting issue from your database to the ASP page.

have you response.write'n the date to ensure that what you think should be coming out is in actuality coming out as the formatted date in the DB

the best suggestion I can also make is to format your code so it is easier to debug.
eg:
Dim URLLink

URLLink = &quot;<a href= Test.asp?Param1=&quot;
URLLink = URLLink & Session(&quot;Param1&quot;) & &quot;&DateTime=&quot; & rsLoad.Fields(&quot;AppDate&quot;) & &quot;>&quot;
URLLink = URLLink & rsLoad.Fields(&quot;DateTimeField&quot;) & &quot;</a>&quot;

response.Write(&quot;<td>&quot; & URLLink & &quot;</TD>&quot;


_____________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
onpnt,
Thanks for your reply and sorry about the confusion. Yes the database is bringing back 1/7/2004 9:02:06 AM and the only part of the response.Write I'm having trouble with is:

response.Write(&quot;<td><a href= Test.asp?Param1=&quot;&Session
(&quot;Param1&quot;)&&quot;&DateTime=&quot;&rsLoad.Fields(&quot;AppDate&quot;)&&quot;>&quot;&rsLoad.Fields(&quot;DateTimeField&quot;)&&quot;</a></td>)

What I was expecting to see in the QueryString was
test.asp?Param1 = param1&DateTime = 1/7/2004 9:02:06 AM

However, all I see is
test.asp?Param1 = param1&DateTime = 1/7/2004

More suggestions are welcomed.

Thanks Again,
Clyde
 
use Server.URLEncode to send the date. That should fix the break

eg:
response.Write(&quot;<td><a href= Test.asp?Param1=&quot;&Session
(&quot;Param1&quot;)&&quot;&DateTime=&quot;&rsLoad.Fields(&quot;AppDate&quot;)&&quot;>&quot;& Server.URLEncode(rsLoad.Fields(&quot;DateTimeField&quot;))&&quot;</a></td>)

_____________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
if taht does not fix it can you view the source of the output form the ASP script and post the HREF tag that is getting generated.

_____________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
onpnt,
Thanks for your reply. I just figured that out and had logged in to let everyone know I figured out I needed to use the Server.Encode function. My code looks exactly like what you posted. Thanks again for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top