Solved

Microsoft Cursor Engine error '80040e21'

Posted on 2009-04-06
11
1,334 Views
Last Modified: 2012-05-06
Hi, I keep getting this error:

  Microsoft Cursor Engine error '80040e21'
  Multiple-step operation generated errors. Check each status value.

I know this error generally appears when trying to enter too much data into a field that hasn't been set big enough.

The code generating the error is below. It appears on the line:
transactionRS("transactionItem") = serviceName

it is trying to enter some data into a MySQL database, the datatype for the filed is VARCHAR(255) but serviceName is a maximum of 20 characters

any suggestions?
transactionRS.AddNew

transactionRS("transactionItem") = serviceName

transactionRS.Update

Open in new window

0
Comment
Question by:roycasella
  • 6
  • 5
11 Comments
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 24077313
can you post the source code before the line:

transactionRS.AddNew


?

make sure you open your recordset is writable?

like:

transactionRS.open yourSQL, conn, 3, 3

?
0
 
LVL 7

Author Comment

by:roycasella
ID: 24077648
here you go:


Set transactionRS = Server.CreateObject("ADODB.Recordset")

transactionQuery = "Select * FROM transactions"

transactionRS.Locktype = 3

transactionRS.CursorLocation = 3

transactionRS.Open transactionQuery, insertConnect

Open in new window

0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 24077937
Ok, that's working fine for me, data is inserted into database:
<%
 

serviceName = "My service " & Now()
 

insertConnect = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test;USER=root;PASSWORD=password"
 

    Set transactionRS = Server.CreateObject("ADODB.Recordset")

    transactionQuery = "Select * FROM transactions"

    transactionRS.LockType = 3

    transactionRS.CursorLocation = 3

    transactionRS.Open transactionQuery, insertConnect

    

    transactionRS.AddNew

    transactionRS("transactionItem") = serviceName

    transactionRS.Update

    

    transactionRS.Close

    Set transactionRS = Nothing
 

response.write "Done! " & Now()
 

%>

Open in new window

0
 
LVL 7

Author Comment

by:roycasella
ID: 24078438
that's what I thought. It's totally confusing me as it seems to work sometimes but not others.
for the following serviceName cases it works
Swap Shop
Stylefile

but for these it doesn't:
Wardrobe Rehab
Delux Wardrobe Rehab

You can see that these are larger strings but it's writing to a field with a datatype of varchar(255)
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 24078554
The values I tested to be inserted into database certainly are longer than "Delux Wardrobe Rehab" and without any problems.

alternatively, you may try use an Insert SQL statement instead, just in case you can't figure it out and you run out of time... like below:
<%

 

serviceName = "My service " & Now()

 

insertConnect = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test;USER=root;PASSWORD=password"

 

    Set conn = Server.CreateObject("ADODB.Connection")

    conn.open insertConnect 
 

    v = Replace(serviceName,"'","''")

    SQL = "Insert into transactions (transactionItem) Values ('" & v & "')"
 

    conn.execute SQL

    conn.close

    set conn = nothing
 

response.write "Done! " & Now()

 

%>

Open in new window

0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 7

Author Comment

by:roycasella
ID: 24088251
ok, tried that. The code below is the actual code in the page.
I've put a Response.Write statement in there to view the generated sql string and it produces valid SQL:
INSERT INTO transactions (date,TxCode,transactionItem,clientId) VALUES ('07-04-2009 16:12:18','stylefile07042009091','Swap Shop Points','3')

But I get the following error:

Microsoft VBScript runtime  error '800a01a8' Object required: '' /protx/buyservice.asp, line 300

line 300 is the line with transactionsRS.execute SQL

SQL = "INSERT INTO transactions (date,TxCode,transactionItem,clientId) VALUES ('" & dateNow & "','" & VendorTxCode & "','" & serviceName & "','" & clientSet__MMColParam & "')"

Response.Write(SQL)

transactionsRS.execute SQL

Open in new window

0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 24088404
>>transactionsRS.execute SQL

?

is transactionsRS an ADODB.Connection object?

please try amend using the scripts posted @ ID:24078554
0
 
LVL 7

Author Comment

by:roycasella
ID: 24088514
Your right, i had it set as the wrong object.
Here's the new full code

MM_sfasp_STRING is the connection string

Dim insertConnect, transactionRS

					

Set transactionRS = Server.CreateObject("ADODB.Connection")

insertConnect = MM_sfasp_STRING

transactionRS.Open insertConnect

					

Dim dateNow, SQL

				

dateNow = Replace(now,"/","-")

SQL = "INSERT INTO transactions (date,TxCode,transactionItem,clientId) VALUES ('" & dateNow & "','" & VendorTxCode & "','" & serviceName & "','" & clientSet__MMColParam & "')"

Response.Write(SQL)

transactionsRS.execute SQL

Open in new window

0
 
LVL 7

Author Comment

by:roycasella
ID: 24088516
whoops, forgot to say that it's still producing the same error
0
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 500 total points
ID: 24088640
you spell it incorrectly...

>>transactionsRS.execute SQL

should be as:

transactionRS.execute SQL
0
 
LVL 7

Author Closing Comment

by:roycasella
ID: 31567011
genius, thanks I know it would be something like that. thank you
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now