We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


AddNew record to visual Foxpro using ASP

Medium Priority
Last Modified: 2013-12-24
I cannot add a simple text value to a new record.  When I add a new record, a stored procedure is tripped to supply a new ID number.  ID is used as the primary key in the table CASHOUT  Removing the stored procedure from the database has no effect on the error received

Dim objConn, rsAns, Connstr
Set objConn =  Server.CreateObject("ADODB.connection")
ConnStr= "Provider=vfpoledb;Data Source=d:\websites\pump\mail\contact.dbc"
Set rsAns= server.CreateObject("adodb.recordset")
rsAns.Open "SELECT * FROM cashout WHERE id=0", objconn,3,3,1         ' this does not return a record id=0 is an impossible result


rsAns.fields("shift")="day"        'fields is defined as character field size is 10


The update command triggers this error message

Microsoft Cursor Engine error '80040e21'

Multiple-step operation generated errors. Check each status value.

Watch Question

Wayne BarronAuthor, Web Developer
Top Expert 2009

to start off with. I have never seen it written out like this:
rsAns.Open "SELECT * FROM cashout WHERE id=0", objconn,3,3,1

I have always seen it written out like this:
mysql =  "SELECT * FROM cashout WHERE id=0"
rsAns.Open mysql, objconn,3,3,1
(I could be way of base on that one, as it is Foxpro, and i use access/sql server)

The issue with the [Update] Error [Microsoft Cursor Engine error '80040e21']
Make sure that you are not trying to insert a string that is too long for a field.

Your Field length is: 50
Your string that you are trying to pass is: 60 characters in length.

Hope this helps.

If the above is your actual code, then I miss a line where you open the connection.
So basically you are working with a closed connection, which of course does not work.
Olaf DoschkeSoftware Developer

You are opening the RS with adOpenStatic.

See here for the possible Parameter values for the CursorType parameter of RS.Open():

try this:
objConn.Open ConnStr
rsAns.Open "SELECT * FROM cashout WHERE id=0", objconn,1,3,1

Open in new window

It turns out that my code is correct.  I traced the problem down to the table itself.  I had to allow for NULL values to be inserted to the table.  When I modified the table structure to allow NULL values in a field, everything worked as it should have

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.