If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Help on Passing Dates through Querystring

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-21-06, 07:01
sandeep_p sandeep_p is offline
Registered User
 
Join Date: Oct 2003
Posts: 2
Question Help on Passing Dates through Querystring

I am creating following query using input from the web form.

ssql = "Select * from vehtran where repdate between #" cdate(txtdtfrom.text) & "# and #" cdate(txtdtto.text) & "# and Status = 'Rep'"

When I then passing this sql string to another web form which will display the search results through following code

Response.redirect("DispRec.aspx?ssql=" & ssql )

However when I am retrieve this sql query in DispRec.aspx, it gives me following Select query which is wrong

Select * from Vehtran where repdate between #11/19/06 and 11/21/06 and Status = 'Rep' - Assuming that txtdtfrom contains date '11/19/06' and txtdtto contains date '11/21/06'.

Can any one guide me what is wrong in passing the querystring ?

When I view this query string in the same web form it is displayed properly as under

Select * from Vehtran where repdate between #11/19/06# and #11/21/06# and Status = 'Rep'

Help in this regards is highly appreciated.

Regards

Sandeep
Reply With Quote
  #2 (permalink)  
Old 12-07-06, 12:21
jzelos jzelos is offline
Registered User
 
Join Date: Dec 2006
Location: UK
Posts: 6
The hash symbol is a special URI character and so would have to be escaped to use it in the query string. (or you could post it via a form)

Not really a good idea to pass the entire SQL string anyway, would be better to just pass the parameters and let your results page create it. Otherwise you could get all sorts of SQL querys being passed (inserts, updates, deletes etc) by mischevous users.

PS: The % symbol is also reserved for denoting escaped values so you would also get problems sending SQL containing wildcards via the query string. IE ...Where Name Like '%jam%'...
J
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On