Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,160,464 members, 7,843,425 topics. Date: Wednesday, 29 May 2024 at 04:00 AM

Gooboy's Posts

Nairaland Forum / Gooboy's Profile / Gooboy's Posts

(1) (of 1 pages)

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

Tank God
Software/Programmer Market / Re: 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.
Programming / Asp Classic To Search For Records Between Two Dates by gooboy(m): 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
Religion / Music Ministry In The Church by gooboy(m): 10:45am On Jan 27, 2011
Why are the churches paying instrumentalists and not all the choir members?

(1) (of 1 pages)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.