Good Day Everyone,
Requesting for your expertise please, in my program the user has to enter the agent name and the from date and to date inorder to display the record. I have to use 2 conditions. First look for the record with the same agent and display all record for that agent but the date should be within the two dates enter. Below are my codes, when running i got the error message invalid data type.
In my database the PROD_ENTERED is date/time format and in the asp code i put a 2 text box where the use has to enter the 2 dates.
please help me. im not really good in asp i'm just a beginner.
thank you for any help or idea you can give.
*************** *************** **************
Set oCon = Server.CreateOb ject ("ADODB.Connect ion")
oCon.Open "Provider=Micro soft.Jet.OLEDB. 4.0; Data Source=" & Server.MapPath( "webprs_db.mdb" ) & ";"
Set Rec = Server.CreateOb ject ("ADODB.Records et")
search = request.queryst ring("search")
agent = request.form("l istagent")
fdate = request.form("t xtfdate")
tdate = request.form("t xttdate")
if agent <> "" then
SQL = "SELECT * FROM WEB_PRODUCTIVIT YDONE WHERE PROD_USER like '%" & agent & "%' AND PROD_ENTERED BETWEEN '%" & fdate & "%' AND '%" & tdate & "%'"
else
SQL = "SELECT * FROM WEB_PRODUCTIVIT YDONE ORDER BY " & 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("PROD_DATE" ) < Date-3 then
rowColor = "Red"
else If Rec("PROD_DATE" ) < Now()-2 then
rowColor = "Blue"
else
rowColor = "Green"
end if
end if
response.write( "<tr>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_RECNO ")& "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_USER" ) & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_SENDE R") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_SENDE RNAME") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_REFDE TAILS") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_CONCE RN") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_DATE" ) & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_ENTER ED") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & "<a href=""prs_view rec.asp?recnum= " & Rec("PROD_RECNO ") & "&user="& rec("PROD_USER" ) &""">" & "<p align=center>" & " View " & "</td>")
Requesting for your expertise please, in my program the user has to enter the agent name and the from date and to date inorder to display the record. I have to use 2 conditions. First look for the record with the same agent and display all record for that agent but the date should be within the two dates enter. Below are my codes, when running i got the error message invalid data type.
In my database the PROD_ENTERED is date/time format and in the asp code i put a 2 text box where the use has to enter the 2 dates.
please help me. im not really good in asp i'm just a beginner.
thank you for any help or idea you can give.
*************** *************** **************
Set oCon = Server.CreateOb ject ("ADODB.Connect ion")
oCon.Open "Provider=Micro soft.Jet.OLEDB. 4.0; Data Source=" & Server.MapPath( "webprs_db.mdb" ) & ";"
Set Rec = Server.CreateOb ject ("ADODB.Records et")
search = request.queryst ring("search")
agent = request.form("l istagent")
fdate = request.form("t xtfdate")
tdate = request.form("t xttdate")
if agent <> "" then
SQL = "SELECT * FROM WEB_PRODUCTIVIT YDONE WHERE PROD_USER like '%" & agent & "%' AND PROD_ENTERED BETWEEN '%" & fdate & "%' AND '%" & tdate & "%'"
else
SQL = "SELECT * FROM WEB_PRODUCTIVIT YDONE ORDER BY " & 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("PROD_DATE" ) < Date-3 then
rowColor = "Red"
else If Rec("PROD_DATE" ) < Now()-2 then
rowColor = "Blue"
else
rowColor = "Green"
end if
end if
response.write( "<tr>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_RECNO ")& "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_USER" ) & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_SENDE R") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_SENDE RNAME") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_REFDE TAILS") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_CONCE RN") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_DATE" ) & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & Rec("PROD_ENTER ED") & "</td>")
response.write( "<td bgcolor="& rowBColor&">" & "<a href=""prs_view rec.asp?recnum= " & Rec("PROD_RECNO ") & "&user="& rec("PROD_USER" ) &""">" & "<p align=center>" & " View " & "</td>")
Comment