-----Original Message-----
From: Cheryl [mailto:
[email protected]]
Posted At: 26. november 2004 12:49
Posted To: microsoft.public.frontpage.programming
Conversation: Passing parameters in form SQL 2000 DB
Subject: Re: Passing parameters in form SQL 2000 DB
Thank you for that information... However, my problem is not
how to break apart a date any longer.. because I can do
that.. finally.... but that I want to know how to use a date
to compare to my passed parameters where if they are equal..
For example.. I have a drop down that consists of employee
name, year and week number. The year and week number were
obtained using datepart since the date is store one field.
can again break apart the date in the sql for the
connection. The sql statement either needs to retrieve only
the records that I require based on the passed parameters now
stored in variables. What I wanted to know is that in the SQL
statement where I do break apart the date... and can retrieve
based on the name
Statement below:
strSQL4 = "SELECT DatePart(yyyy, DateWorked) as YearPart,
DatePart(month,
DateWorked) as MonthPart, DatePart(dd, DateWorked) as
DayPart, DatePart(dw,
DateWorked) as WeekDayPart, DatePart(ww, DateWorked) as
WeekNumberPart, * FROM Employees, TimeSheets where (FullName
= '"&VarName&"')
Can I use "YearPart" as part of the where statement in the
same SQL ie.
SELECT DatePart(yyyy, DateWorked) as YearPart .....
where (FullName = '"&VarName&"' and YearPart='"&VarYear&"' ) ... etc
I also tried to Just compare the fields based on the YearPart
and varYear as well instead of part of the SQL but it doesn't
find a match... But if I use response.write varYear and
YearPart.. they both contain matching data so it should find it.
strSQL4 = "SELECT DatePart(yyyy, DateWorked) as YearPart,
DatePart(month,
DateWorked) as MonthPart, DatePart(dd, DateWorked) as
DayPart, DatePart(dw,
DateWorked) as WeekDayPart, DatePart(ww, DateWorked) as
WeekNumberPart, * FROM Employees, TimeSheets where (FullName
= '"&VarName&"') ORDER BY DateWorked ASC, JobNumberID ASC,
PartNumber ASC, Other ASC, FullName ASC"
objRecordset4.Open strSQL4, objConn4
objRecordset4.movefirst %>
<% do while not objRecordset4.EOF %>
<% if objRecordset4("YearPart") =
varYear then %>
So I can't make either way work... It extracts the all of the
data for the employee if I don't try and compare... but finds
nothing if I try to compare YearPart and varYear
Jens Peter Karlsen said:
Have a look at this page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlr
ef
/ts_da-db_2mic.asp
It describes datepart and gives examples.
Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
-----Original Message-----
From: Cheryl [mailto:
[email protected]]
Posted At: 25. november 2004 14:07
Posted To: microsoft.public.frontpage.programming
Conversation: Passing parameters in form SQL 2000 DB
Subject: Re: Passing parameters in form SQL 2000 DB
Ok... I was able to pass the parameter over.. my next problem is:
Can I use: SELECT DatePart(yyyy, DateWorked) as YearPart
which is part of the sql to compare with the variable sent from the
dropdown?
YearPart = '"&VarYear&"' ) ..
The date in the SQL database is stored as one field but I needed to
break apart the date to search for information by Name, Year and
Week Number so that only the selected items show up...
strSQL4 = "SELECT DatePart(yyyy, DateWorked) as YearPart,
DatePart(month,
DateWorked) as MonthPart, DatePart(dd, DateWorked) as DayPart,
DatePart(dw,
DateWorked) as WeekDayPart, DatePart(ww, DateWorked) as
WeekNumberPart, * FROM Employees, TimeSheets where (FullName =
'"&VarName&"' and YearPart = '"&VarYear&"' ) .....
:
When you submit the page, you use ASP to get the values
from the Form
collection and store it in variables that you use to form the Query.
Something like:
Dim option1, option2, option3, strQuery
option1=Form(fieldname).value
....
....
and your query
strQuery="SELECT * from someTable WHERE tablefield='"&
option1 &"' AND
.....
Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
-----Original Message-----
From: Cheryl [mailto:
[email protected]]
Posted At: 24. november 2004 15:49 Posted To:
microsoft.public.frontpage.programming
Conversation: Passing parameters in form SQL 2000 DB
Subject: Passing parameters in form SQL 2000 DB
I need to know how to pass parameters from several drop
down lists
on a form to be able to search for particular records.
We have frontpage 2003 and connecting to SQL 2000 on
Windows Small
Business Server.
Thanks in advance