...

View Full Version : No value given for one or more parameter



daisy_polly
06-04-2007, 09:13 PM
Hi,
I am getting the " no value given for one or more".... error. I get the error as soon as i put the date functions in the query.



<%
Dim storeMonth
'Opening a text file to get the month
Set fs=Server.CreateObject("Scripting.FileSystemObject")

Set f=fs.OpenTextFile(Server.MapPath("settings.dat"), 1)
storeMonth=f.readall


'Done reading

Set rscount = Server.CreateObject("ADODB.Recordset")
' Initialization '
cnstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath("data1.mdb")

sqlquery = "SELECT Count(id) as temp FROM data where Month(Date_Recv)=Month(Date()) and Year(Date_Recv)=Year(Date())"

' Open the connection and populate the recordset '
rscount.open sqlquery,cnstring
' Test if there are any records '
If not rscount.eof then
' Move to the first record'
rscount.MoveFirst
Response.Write "<tr><td>"& storeMonth& "</tr></td>"


While rscount.EOF = false

Response.Write "<tr><td>" & rscount.Fields("temp").Value & "</td></tr>"
rscount.movenext
Wend

end if

' Close the recordset / connection '
rscount.close

' Garbage collection / memory management'
set rscount = nothing
f.Close
Set f=Nothing
Set fs=Nothing

%>

thanks in advance to anyone who helps.
DA

mehere
06-04-2007, 09:54 PM
try concatenating the sql string

"SELECT Count(id) as temp FROM data where Month(Date_Recv)='" & Month(Date()) & "' and Year(Date_Recv)='" & Year(Date()) & "'"

daisy_polly
06-05-2007, 01:52 PM
thanks I am still getting the same error.

Daemonspyre
06-05-2007, 02:04 PM
Can you do a response.write of the sqlquery?



sqlquery = "SELECT Count(id) as temp FROM data where Month(Date_Recv)=Month(Date()) and Year(Date_Recv)=Year(Date())"
'
response.write sqlquery
response.flush
'
'


That will tell you what is missing and may help you figure this out. It may not be a missing parameter, rather a parameter of an incorrect type, i.e. you are looking for a date and it's returning a string.

daisy_polly
06-08-2007, 02:15 PM
thanks a bunch! The field name i was using was wrong.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum