₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,734 members, 8,423,501 topics. Date: Tuesday, 09 June 2026 at 07:38 PM

Toggle theme

Gooboy's Posts

Nairaland ForumGooboy's ProfileGooboy's Posts

1 (of 1 pages)

ProgrammingRe: Asp Classic To Search For Records Between Two Dates by gooboy(op): 1:32pm On Mar 02, 2011
Yeah, I did it successfully

Tank God
Tech JobsRe: Programming Assignment Help (will Pay For The Service) by gooboy(m): 1:28pm On Mar 02, 2011
Ok bros I tink I can help u on this, but I hvt kno wat extly u wnt the programe to do. U can call me on this number 01-9549333.
ProgrammingAsp Classic To Search For Records Between Two Dates by gooboy(op): 4:13pm On Feb 24, 2011
Hi all,

Im a beginner in ASP programming n MS SQL server. I created a table named DataReport in SQL server with the following colom
1. Date
2. Item
3. Location
4. Rate
5. Price

I created an HTML form page with three imput fields namely, Location, Datefrom, and Dateto. What I want to achiev is dat when user enter a location and the date from and date, then submit the form, an ASP page will show to display the data from the location selected and within the dates input in the form field. However, all records in the table were displayed regardless of location typed or date range selected.

below is my ASP code


<%


Set oCon = Server.CreateObject ("ADODB.Connection"wink
oCon.Open "Provider=sqloledb;Data Source=RESEARCH\SQLEXPRESS;Initial Catalog=smarta;User Id=sa;Password=10010;"

Set Rec = Server.CreateObject ("ADODB.Recordset"wink


search = request.querystring("search"wink
location = request.form("slocation"wink
datefrom = request.form("datefrom"wink
dateto = request.form("dateto"wink

if agent <> "" then

SQL = "SELECT * FROM DataReport WHERE location like '%" & slocation & "%' AND DATE BETWEEN #" & Format(datefrom,"mm/dd/yyyy"wink & "# and #" & Format(dateto,"mm/dd/yyyy"wink & "#;"




else

SQL = "SELECT * FROM DataReport ORDER BY Item" & sort
End if
Rec.Open SQL, oCon

if Rec.EOF OR Rec.BOF Then
response.write "<br><br>"

response.write "<p align=center><b>No Records Found , </b></p>"

end if


Do While Not Rec.EOF
'AND DisplayNum < 5
r = n Mod 2
if r <> 0 then
'rowBColor = "#99CCFF"
rowBColor = "white"
else
'rowBColor = "#CCFFFF"
rowBColor = "#FFFFFF"
end if

If Rec("DATE"wink < Date-3 then
rowColor = "Red"
else If Rec("DATE"wink < Now()-2 then
rowColor = "Blue"
else
rowColor = "Green"
end if
end if

response.write("<tr>"wink
response.write("<td bgcolor="& rowBColor&">" & Rec("Item"wink& "</td>"wink
response.write("<td bgcolor="& rowBColor&">" & Rec("Location"wink & "</td>"wink
response.write("<td bgcolor="& rowBColor&">" & Rec("rate"wink & "</td>"wink
response.write("<td bgcolor="& rowBColor&">" & Rec("price"wink & "</td>"wink
response.write("<td bgcolor="& rowBColor&">" & Rec("total"wink & "</td>"wink
response.write("<td bgcolor="& rowBColor&">" & Rec("Status"wink & "</td>"wink
response.write("<td bgcolor="& rowBColor&">" & Rec("Approved"wink & "</td>"wink
response.write("<td bgcolor="& rowBColor&">" & Rec("date"wink & "</td>"wink

%>
<% rec.MoveNext
Loop
%>


Pls I will be happy if I can get way out to this problem
Christianity EtcMusic Ministry In The Church by gooboy(op): 10:45am On Jan 27, 2011
Why are the churches paying instrumentalists and not all the choir members?

1 (of 1 pages)