This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Front Page > February 2004 > Date query problem in DRW





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Date query problem in DRW
Targa

2004-02-29, 1:28 am

This is driving me nuts!

What is wrong with this code?

var1 = request.QueryString
"SELECT ID,lname,fname FROM Schedule WHERE Sched_Date = #" & var1 & "# "

or even this one:
"SELECT ID,lname,fname FROM Schedule WHERE Sched_Date = #" &
request.QueryString & "# "

I keep getting "Syntax error in date in query expression"

The querystring is in proper date format when I do
reposne.write request.QueryString

FP2002, IIS5, Access 2002

Thanks in advance,
Mike


Thomas A. Rowe

2004-02-29, 2:28 am

Is the querystring sending a valid date string?

Try this in place of your request.QueryString:

var1 = Date()

Just for testing with the file one listed.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

"Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
news:OhIEz7n$DHA.1732@TK2MSFTNGP12.phx.gbl...
> This is driving me nuts!
>
> What is wrong with this code?
>
> var1 = request.QueryString
> "SELECT ID,lname,fname FROM Schedule WHERE Sched_Date = #" & var1 & "# "
>
> or even this one:
> "SELECT ID,lname,fname FROM Schedule WHERE Sched_Date = #" &
> request.QueryString & "# "
>
> I keep getting "Syntax error in date in query expression"
>
> The querystring is in proper date format when I do
> reposne.write request.QueryString
>
> FP2002, IIS5, Access 2002
>
> Thanks in advance,
> Mike
>
>



Targa

2004-02-29, 2:28 am

Yes. The querystring is actually coming from a calendar component.

response.write var1

result: 2/28/2004






"Thomas A. Rowe" <tarowe@mvps.org> wrote in message
news:O5l%234Wo$DHA.1796@TK2MSFTNGP12.phx.gbl...
> Is the querystring sending a valid date string?
>
> Try this in place of your request.QueryString:
>
> var1 = Date()
>
> Just for testing with the file one listed.
>
> --
>
> ==============================================
> Thomas A. Rowe (Microsoft MVP - FrontPage)
> WEBMASTER Resources(tm)
> http://www.ycoln-resources.com
> FrontPage Resources, WebCircle,
> MS KB Quick Links, etc.
> ==============================================
> To assist you in getting the best answers for FrontPage support see:
> http://www.net-sites.com/sitebuilder/newsgroups.asp
>
> "Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
> news:OhIEz7n$DHA.1732@TK2MSFTNGP12.phx.gbl...
>
>



Thomas A. Rowe

2004-02-29, 2:28 am

Ok, then check the database field to be sure that it is a date field, set to
short date.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

"Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
news:urO33ao$DHA.3184@TK2MSFTNGP09.phx.gbl...
> Yes. The querystring is actually coming from a calendar component.
>
> response.write var1
>
> result: 2/28/2004
>
>
>
>
>
>
> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
> news:O5l%234Wo$DHA.1796@TK2MSFTNGP12.phx.gbl...
"[color=darkred]
>
>



Targa

2004-02-29, 2:28 am

It is.

Actually, it works when I use an actual variable name like this:
SELECT ID,lname,fname FROM Schedule WHERE Sched_Date = #::Date1::# "

My problem is that I have to capture a query from 1 of 3 different links:

mypage.asp?Date1=2/28/2004
mypage.asp?Date2=3/28/2004
mypage.asp?Date3=4/28/2004

That's why Im trying to use the Request.QueryString

Maybe there's a better way to acheive this?

Thanks!


"Thomas A. Rowe" <tarowe@mvps.org> wrote in message
news:u3sMheo$DHA.2348@TK2MSFTNGP09.phx.gbl...
> Ok, then check the database field to be sure that it is a date field, set

to
> short date.
>
> --
>
> ==============================================
> Thomas A. Rowe (Microsoft MVP - FrontPage)
> WEBMASTER Resources(tm)
> http://www.ycoln-resources.com
> FrontPage Resources, WebCircle,
> MS KB Quick Links, etc.
> ==============================================
> To assist you in getting the best answers for FrontPage support see:
> http://www.net-sites.com/sitebuilder/newsgroups.asp
>
> "Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
> news:urO33ao$DHA.3184@TK2MSFTNGP09.phx.gbl...
"#[color=darkred]
> "
>
>



Thomas A. Rowe

2004-02-29, 2:28 am

Sorry, I didn't notice that you Request.QueryString didn't contain a source
name.

If the data value will only be submitted individually, then you can past
them all using the same source name.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

"Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
news:elW8$qo$DHA.3184@TK2MSFTNGP09.phx.gbl...
> It is.
>
> Actually, it works when I use an actual variable name like this:
> SELECT ID,lname,fname FROM Schedule WHERE Sched_Date = #::Date1::# "
>
> My problem is that I have to capture a query from 1 of 3 different links:
>
> mypage.asp?Date1=2/28/2004
> mypage.asp?Date2=3/28/2004
> mypage.asp?Date3=4/28/2004
>
> That's why Im trying to use the Request.QueryString
>
> Maybe there's a better way to acheive this?
>
> Thanks!
>
>
> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
> news:u3sMheo$DHA.2348@TK2MSFTNGP09.phx.gbl...
set[color=darkred]
> to
&[color=darkred]
> "#
>
>



Targa

2004-02-29, 3:28 am

I have no control over the source name as its .dll component.
Its a calendar component in which Im displaying 3 months at a time.

Each instance has its own source name.

Maybe time to find a new calendar?

Thanks for your help,
Mike


"Thomas A. Rowe" <tarowe@mvps.org> wrote in message
news:OFssy1o$DHA.2476@TK2MSFTNGP12.phx.gbl...
> Sorry, I didn't notice that you Request.QueryString didn't contain a

source
> name.
>
> If the data value will only be submitted individually, then you can past
> them all using the same source name.
>
> --
>
> ==============================================
> Thomas A. Rowe (Microsoft MVP - FrontPage)
> WEBMASTER Resources(tm)
> http://www.ycoln-resources.com
> FrontPage Resources, WebCircle,
> MS KB Quick Links, etc.
> ==============================================
> To assist you in getting the best answers for FrontPage support see:
> http://www.net-sites.com/sitebuilder/newsgroups.asp
>
> "Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
> news:elW8$qo$DHA.3184@TK2MSFTNGP09.phx.gbl...
links:[color=darkred]
> set
see:[color=darkred]
var1[color=darkred]
> &
>
>



Thomas A. Rowe

2004-02-29, 3:28 am

Try this:

<%
Var1 = Request.QueryString("Date1")
Var2 = Request.QueryString("Date2")
Var3 = Request.QueryString("Date3")

If Var1 > 0 then
varDate = Request.QueryString("Date1")
End If
If Var2 > 0 then
varDate = Request.QueryString("Date2")
End If
If Var3 > 0 then
varDate = Request.QueryString("Date3")
End If
%>

You could also do this using ElseIf and Else, I just perfer not to..
--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

"Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
news:%23fzjG%23o$DHA.3828@TK2MSFTNGP10.phx.gbl...
> I have no control over the source name as its .dll component.
> Its a calendar component in which Im displaying 3 months at a time.
>
> Each instance has its own source name.
>
> Maybe time to find a new calendar?
>
> Thanks for your help,
> Mike
>
>
> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
> news:OFssy1o$DHA.2476@TK2MSFTNGP12.phx.gbl...
> source
> links:
field,[color=darkred]
> see:
> var1
>
>



Thomas A. Rowe

2004-02-29, 3:28 am

Correction:

<%
If Trim(Request.QueryString("Date1")) > " " then
varDate = Trim(Request.QueryString("Date1"))
End If
If Trim(Request.QueryString("Date2")) > " " then
varDate = Trim(Request.QueryString("Date2"))
End If
If Trim(Request.QueryString("Date3")) > " " then
varDate = Trim(Request.QueryString("Date2"))
End If
%>
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

"Thomas A. Rowe" <tarowe@mvps.org> wrote in message
news:O6bPgKp$DHA.220@TK2MSFTNGP09.phx.gbl...
> Try this:
>
> <%
> Var1 = Request.QueryString("Date1")
> Var2 = Request.QueryString("Date2")
> Var3 = Request.QueryString("Date3")
>
> If Var1 > 0 then
> varDate = Request.QueryString("Date1")
> End If
> If Var2 > 0 then
> varDate = Request.QueryString("Date2")
> End If
> If Var3 > 0 then
> varDate = Request.QueryString("Date3")
> End If
> %>
>
> You could also do this using ElseIf and Else, I just perfer not to..
> --
>
> ==============================================
> Thomas A. Rowe (Microsoft MVP - FrontPage)
> WEBMASTER Resources(tm)
> http://www.ycoln-resources.com
> FrontPage Resources, WebCircle,
> MS KB Quick Links, etc.
> ==============================================
> To assist you in getting the best answers for FrontPage support see:
> http://www.net-sites.com/sitebuilder/newsgroups.asp
>
> "Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
> news:%23fzjG%23o$DHA.3828@TK2MSFTNGP10.phx.gbl...
past[color=darkred]
> field,
see:[color=darkred]
component.[color=darkred]
support[color=darkred]
>
>



Targa

2004-02-29, 3:28 pm

Then Im back to my original problem - pulling the var into my select
statement:
"SELECT ID,lname,fname FROM Schedule WHERE Sched_Date = #" & varDate & "# "

Still throws the syntax error in date query.



"Thomas A. Rowe" <tarowe@mvps.org> wrote in message
news:uqIy%23Op$DHA.2448@TK2MSFTNGP12.phx.gbl...
> Correction:
>
> <%
> If Trim(Request.QueryString("Date1")) > " " then
> varDate = Trim(Request.QueryString("Date1"))
> End If
> If Trim(Request.QueryString("Date2")) > " " then
> varDate = Trim(Request.QueryString("Date2"))
> End If
> If Trim(Request.QueryString("Date3")) > " " then
> varDate = Trim(Request.QueryString("Date2"))
> End If
> %>
> ==============================================
> Thomas A. Rowe (Microsoft MVP - FrontPage)
> WEBMASTER Resources(tm)
> http://www.ycoln-resources.com
> FrontPage Resources, WebCircle,
> MS KB Quick Links, etc.
> ==============================================
> To assist you in getting the best answers for FrontPage support see:
> http://www.net-sites.com/sitebuilder/newsgroups.asp
>
> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
> news:O6bPgKp$DHA.220@TK2MSFTNGP09.phx.gbl...
> past
"[color=darkred]
> see:
> component.
> support
&[color=darkred]
&[color=darkred]
>
>



Thomas A. Rowe

2004-02-29, 10:28 pm

Can you zip a copy of your database and all page and email me?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)
http://www.ycoln-resources.com
FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
To assist you in getting the best answers for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp

"Targa" <targa1SPAMSUCKS@alltel.net> wrote in message
news:e2YFiPv$DHA.2056@TK2MSFTNGP11.phx.gbl...
> Then Im back to my original problem - pulling the var into my select
> statement:
> "SELECT ID,lname,fname FROM Schedule WHERE Sched_Date = #" & varDate & "#

"
>
> Still throws the syntax error in date query.
>
>
>
> "Thomas A. Rowe" <tarowe@mvps.org> wrote in message
> news:uqIy%23Op$DHA.2448@TK2MSFTNGP12.phx.gbl...
a[color=darkred]
can[color=darkred]
see:[color=darkred]
#::Date1::#[color=darkred]
> "
different[color=darkred]
support[color=darkred]
#"[color=darkred]
> &
#"[color=darkred]
> &
expression"[color=darkred]
>
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews