Hi there...
I keep getting an error on my asp page that is telling me too few parameters. I have gotten this error before but cannot remember how to fix it.
I have an htm page that the user puts in there id and the year they are looking for, this then goes to my asp page. Here is the error and the code for the asp
ERROR
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4.
/sickdays.asp, line 60
**********
CODE
<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim objConn
Dim rs
Dim current_datetime
'open up a connection
set objConn = Server.CreateObject("ADODB
.Connectio
n")
objConn.ConnectionString= "DSN=timesheet.dsn"
objConn.Open
response.expires = 0
set rs = server.createobject("adodb
.recordset
")
current_datetime = formatdatetime(date(), 1)
Dim usersrch
usersrch = request.form("cs_empid")
%>
<html>
<head>
<title>SickDays</title>
<base target="_top">
</head>
<H1><FONT style=FONT-SIZE:30pt Face="Times New Roman" Color=#000080><B>Sick Days Report</FONT></B></H1>
<br>
<br>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 >
<TR HEIGHT=18 >
<TD WIDTH=4 ALIGN=LEFT> <BR></TD>
<TD WIDTH=112 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:12pt FACE="Times New Roman" COLOR=#000080>ID</FONT></B
></I></TD>
<TD WIDTH=108 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:11pt FACE="Times New Roman" COLOR=#000080>First Name</FONT></B></I></TD>
<TD WIDTH=104 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:11pt FACE="Times New Roman" COLOR=#000080>Last Name</FONT></B></I></TD>
<TD WIDTH=104 ALIGN=RIGHT><B><I><FONT style=FONT-SIZE:11pt FACE="Times New Roman" COLOR=#000080>Years of Service</FONT></B></I></TD
>
<TD WIDTH=148 ALIGN=RIGHT><B><I><FONT style=FONT-SIZE:11pt FACE="Times New Roman" COLOR=#000080>Date Worked</FONT></B></I></TD>
<TD WIDTH=50 ALIGN=LEFT><BR></TD>
<TD WIDTH=130 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:11pt FACE="Times New Roman" COLOR=#000080>Hours Absent With Pay</FONT></B></I></TD>
<TD WIDTH=145 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:11pt FACE="Times New Roman" COLOR=#000080>Hours Absent Without Pay</FONT></B></I></TD>
<TD WIDTH=148 ALIGN=RIGHT><B><I><FONT style=FONT-SIZE:11pt FACE="Times New Roman" COLOR=#000080>Absent Code</FONT></B></I></TD>
</TR>
</TABLE>
<%
Dim strSQL
strSQL = "SELECT [Employee Info].ID, [Employee Info].First_Name, [Employee Info].Last_Name, [Employee Info].[Years of Service], timeperiod.date_worked, timeperiod.Hrs_abs_w_pay, timeperiod.Hrs_abs_wo_pay,
timeperiod.Absent_code " & _
" FROM [EmployeeInfo] INNER JOIN timeperiod ON [EmployeeInfo].ID = timeperiod.id " & _
" WHERE ((timeperiod.Absent_code)=
11) AND employeeInfo.ID='"&usersrc
h&"';"
'create a recordset object
Dim objRS
Set objRS = Server.CreateObject("ADODB
.RecordSet
")
objRS.Open strSQL, objConn,3,3
If NOT objRs.EOF Then
While Not objRs.EOF
Response.Write "<TABLE><TR><TD WIDTH=112 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:12pt FACE=""Times New Roman""COLOR=#000080>"&(ob
jRS("id"))
&"</FONT><
/B></I></T
D>"
Response.Write "<TD WIDTH=108 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:11pt FACE=""Times New Roman"" COLOR=#000080>"&(objRS("Fi
rst_Name")
)& "</FONT></B></I></TD>"
Response.Write "<TD WIDTH=104 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:11pt FACE=""Times New Roman"" COLOR=#000080>"&(objRS("La
st_Name"))
& "</FONT></B></I></TD>"
Response.Write "<TD WIDTH=104 ALIGN=RIGHT><B><I><FONT style=FONT-SIZE:11pt FACE=""Times New Roman"" COLOR=#000080>"&(objRS("Ye
arsofServi
ce"))&"</F
ONT></B></
I></TD>"
Response.Write "<TD WIDTH=148 ALIGN=RIGHT><B><I><FONT style=FONT-SIZE:11pt FACE=""Times New Roman"" COLOR=#000080>"&(objRS("Da
te_worked"
))&"</FONT
></B></I><
/TD>"
Response.Write "<TD WIDTH=108 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:11pt FACE=""Times New Roman"" COLOR=#000080>"&(objRS("Hr
s_abs_w_pa
y"))&"</FO
NT></B></I
></TD>"
Response.Write "<TD WIDTH=108 ALIGN=LEFT><B><I><FONT style=FONT-SIZE:11pt FACE=""Times New Roman"" COLOR=#000080>"&(objRS("Hr
s_abs_wo_p
ay"))&"</F
ONT></B></
I></TD>"
Response.Write "<TD WIDTH=148 ALIGN=RIGHT><B><I><FONT style=FONT-SIZE:11pt FACE=""Times New Roman"" COLOR=#000080>"&(objRS("Ab
sent_code"
))&"</FONT
></B></I><
/TD></TR><
/Table>"
objRS.MoveNext
wend
End If
'clean up ADO objects
objRS.Close
Set objRs = Nothing
objConn.Close
Set objConn = Nothing
%>
</html>
Start Free Trial