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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Someone Correct Me???

Status
Not open for further replies.

SHARKY99

Programmer
Oct 25, 2001
473
CA
Hi all, i'm writing an ASP code which uses SQL in a Query.

The problem is i must use a variable in my query but it doesn't work? There must be an error in my code but i don't have the time to play with it.

I've generated my code in Access and made a few changes....

Here is my code
Code:
TstDatStart = 11/1/2001
TstDatEnd = 11/21/2001
set dbReserv= server.createObject("ADODB.Connection")
set rsHorCou=server.createObject("ADODB.Recordset")
dbReserv.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("..") & "/dbs/BDReservation.mdb"
vSql=&quot;SELECT QryB1204.Date, QryB1204.[8h00], QryB1204.[8h30], QryB1204.[9h00], QryB1204.[9h30], QryB1204.[10h00], QryB1204.[10h30], QryB1204.[11h00], QryB1204.[11h30], QryB1204.[12h00], QryB1204.[12h30], QryB1204.[13h00], QryB1204.[13h30], QryB1204.[14h00], QryB1204.[14h30], QryB1204.[15h00], QryB1204.[15h30], QryB1204.[16h00], QryB1204.[16h30], QryB1204.[17h00], QryB1204.[17h30], QryB1204.[18h00], QryB1204.[18h30], QryB1204.[19h00], QryB1204.[19h30], QryB1204.[20h00], QryB1204.[20h30], QryB1204.[21h00], QryB1204.[21h30], QryB1204.[22h00], QryB1204.[22h30] FROM QryB1204 WHERE (((QryB1204.Date)>#'&quot; & TstDatStart & &quot;'# And (QryB1204.Date)<#'&quot; & TstDatEnd & &quot;'#)) ORDER BY QryB1204.Date;&quot;

Thanks in advance

Sharky99
 
More info is always good .. like

what happens, and

what the error message is (if any).

Also my guess is you're trying to run a SQL statement utilising an Access Query, which I'm not sure you can do.
What I know you can do is make the above statement into an Access Query and call that (from memory you'd have to call it as if it were a stored procedure). <insert witticism here>
codestorm
 
No it's ok to use it. I get an error for the ASP variable i included in the SQL.

Code:
FROM QryB1204 WHERE (((QryB1204.Date)>#'&quot; & TstDatStart & &quot;'# And (QryB1204.Date)<#'&quot; & TstDatEnd & &quot;'#)) ORDER BY QryB1204.Date;&quot;

' And that's the original

FROM QryB1204 WHERE (((QryB1204.Date)>#11/1/2001# And (QryB1204.Date)<#11/21/2001#)) ORDER BY QryB1204.Date;&quot;

I just need to know how to include an ASP var in the SQL for now but i'll be back soon X-)

Sharky99 >:):O>
 
aHH, it appears you've whacked in a few single quotes (').
Should work if you remove those. <insert witticism here>
codestorm
 
Cool thanks bro...Working perfectly.

Another problem i need to get today's date(ok i can do it), display a seven days calendar but always starting on sundays(so far so good)...let me explain today: 11/12/2001 monday

i need to show

sunday monday tuesday ...
11/11/2001 11/12/2001 11/13/2001 ...

and after i'll have to move seven days later and so on....

but can i add days and end up with the good date and month?? i don't think so but there must be a way....
Open a calendar on the clients side??? Possible??

Thanks Getting serious s-)


Sharky99 >:):O>
 
I think from memory with javascript dates you can simplt add days and it handles incrementing months/years, etc.

May also work in VBS, not sure
<insert witticism here>
codestorm
 
Thanks but where could i find the code for it...o don't have the time to create one.

By the way what's &quot;witticism&quot; never heard before?? i'm french LOL

Sharky99 >:):O>
 
*chuckle* witty or clever remark, pretty much.

So you want a whole ASP or script calendar - not sure, never needed one. <insert witticism here>
codestorm
 
Ok i found some code but it's not what i need. I just need a code like you said:

&quot;I think from memory with javascript dates you can simplt add days and it handles incrementing months/years, etc.&quot;

That's what i need or in VBS

Thanks


Sharky99 >:):O>
 
Well, how about this ..

<html>
<head></head>
<body>
<script language=javascript>
var dt_date;
dt_date = new Date(&quot;Jan 31, 2001 09:00:00&quot;);
dt_date.setDate(dt_date.getDate()+1);
alert(dt_date.getDate() + &quot; &quot; + (dt_date.getMonth()+1) + &quot; &quot; + dt_date.getYear());
</script>
</body>
</html> <insert witticism here>
codestorm
 
Thanks codestorm

I'll try it ASAP...

Sharky99 >:):O>
 
Just fund out how in VBS there it is

Code:
<%@ Language=VBScript %>
<% Option Explicit %>
<%
dim TodaysDate, NewDate
TodaysDate = DATE

NewDate = DateAdd(&quot;D&quot;, +1, TodaysDate)
Response.Write(NewDate)
%>

Thanks again and i'll try your code anyway(might be usefull)


Sharky99 >:):O>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top