Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: No Value Given for Required Parameter


Message #1 by "raven" <msp2you@h...> on Sun, 1 Dec 2002 20:56:52
I have the following code:

Dim intEmployeeNumber
     Dim objCommand, rsAttendance
     Set objCommand=Server.CreateObject("ADODB.Command")
     Const adCmdText=1
     intEmployeeNumber=Session("Employee_Number")
     Response.Write intemployeenumber
     objCommand.ActiveConnection=objConn
     objCommand.CommandText="SELECT * FROM Attendance Where 
Professional_Number = CInt(intemployeenumber)"
     objCommand.CommandType=adCmdText
     Set rsAttendance=objCommand.Execute
     Set objCommand=Nothing

     While not rsAttendance.EOF
      Response.Write rsattendance("Attendence_Number")
      rsAttendance.MoveNext
     Wend

The Response.Write is giving me the value - so I know it's there.
I'm getting the No Value Given for Required Parameter error.
I think my problem is in the syntex - how do I punctuate the statement 
with a variable name that refers to a number??

Thank you!
Message #2 by "raven" <msp2you@h...> on Sun, 1 Dec 2002 21:22:27
I found the answer!
Here is the correct syntax:
objCommand.CommandText="SELECT * FROM Attendance Where Professional_Number 
= " & intemployeenumber & " " 


> I have the following code:

> Dim intEmployeeNumber
 >     Dim objCommand, rsAttendance
 >     Set objCommand=Server.CreateObject("ADODB.Command")
 >     Const adCmdText=1
 >     intEmployeeNumber=Session("Employee_Number")
 >     Response.Write intemployeenumber
 >     objCommand.ActiveConnection=objConn
 >     objCommand.CommandText="SELECT * FROM Attendance Where 
P> rofessional_Number = CInt(intemployeenumber)"
 >     objCommand.CommandType=adCmdText
 >     Set rsAttendance=objCommand.Execute
 >     Set objCommand=Nothing

>      While not rsAttendance.EOF
 >      Response.Write rsattendance("Attendence_Number")
 >      rsAttendance.MoveNext
 >     Wend

> The Response.Write is giving me the value - so I know it's there.
I> 'm getting the No Value Given for Required Parameter error.
I>  think my problem is in the syntex - how do I punctuate the statement 
w> ith a variable name that refers to a number??

> Thank you!

  Return to Index