VJV
VJV

Reputation: 109

Out of 10, 3 times I get this error : Microsoft JET Database Engine error '80040e10' No value given for one or more required parameters

I really don't understand this. I have a simple ASP with 3 div in it. Each div has some HTML with list boxes fills values when page loads.

When ever I run this page, Most of the times it works ok but 3 times out of approx 10, i get this.

Microsoft JET Database Engine error '80040e10' No value given for one or more required parameters. /order_tracking/order_admin.asp, line 269

This line has this query written: THIS IS THE FIRST QUERY ON THE PAGE Error It say on the line where rsRecordSet.Open is written

<%Set rsRecordSet = Server.CreateObject("ADODB.Recordset")
rsRecordSet.Open "select top 1 * from orders  order by id desc", cn
While not rsRecordSet.EOF
%>
<input type="text" size="15"  id="last_order_no" name="last_order_no" value="<%=rsRecordSet("order_no")%>" disabled="disabled"/>
<%rsRecordSet.MoveNext
Wend
If rsRecordSet.State = adStateOpen Then rsRecordSet.Close
Set rsRecordSet= nothing
%>

Please suggest whats wrong...i would appreciate.

Upvotes: 1

Views: 1942

Answers (1)

Shadow Wizard
Shadow Wizard

Reputation: 66388

Sounds like internal database problem if it sometimes work and sometimes it doesn't work.

Do you have lots of traffic? If so, you better move to modern database like SQL Server or MySQL.

Anyway, I will try those things first and see what happens:

  1. Change the code to be:

    Set rsRecordSet = cn.Execute("select top 1 * from orders  order by id desc")
    

    Why it might work? Because the Open method is using cursors and locks that might be "heavy". Using Execute of the connection itself should be as "light weighted" as possible.

  2. Change the SQL statement to be:

    "select top 1 [order_no] from [orders]  order by [id] desc"
    

    Maybe it will help - Access is sensitive about field names sometimes.

  3. Change the code to:

    rsRecordSet.Open "select * from orders  order by id desc", cn
    IF not rsRecordSet.EOF Then %>
        <input type="text" size="15"  id="last_order_no" name="last_order_no" value="<%=rsRecordSet("order_no")%>" disabled="disabled"/> <%
    End If
    

    Maybe the Select Top is doing some nasty stuff behind the scenes.

  4. As last resort before giving up, write Stored Procedure returning that single record and use it instead of raw SQL statement.

Upvotes: 1

Related Questions