Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 302445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:05:53+00:00 2026-05-12T07:05:53+00:00

I have the following subroutine in a classic ASP class that calls the ADO

  • 0

I have the following subroutine in a classic ASP class that calls the ADO UPDATE method. I’m using mySQL db using ODBC driver 5.1.

If I all the subroutine I get the following error:

Microsoft Cursor Engine error ‘80004005’
Key column information is insufficient or incorrect. Too many rows were affected by update.

Public Sub Update(table,id_field,id,fields,values)
    Dim yy
    Dim strQuery
    Dim strFields
    Const adOpenDynamic = 2
    Const adLockOptimistic = 3
    Const adCmdText = 1
    strQuery = ""
    For yy = LBound(fields) to UBound(fields)
            strQuery = strQuery & fields(yy) & ", "
    Next
    strQuery = Left(strQuery, Len(strQuery) - 2)
    strQuery = "select " & strQuery & " from " & table & " where " & id_field & "=" & id
    i_objRS.CursorLocation = 3
    i_objRS.Open strQuery, i_objDataConn, adOpenDynamic, adLockOptimistic, adCmdText
    For yy = 0 To UBound(fields)
            i_objRS(fields(yy)) = values(yy)
    Next
    i_objRS.Update
    i_objRS.Close
End Sub

I’ve tried changing the cursorlocation property and the open parameters but still cannot get it to work. The table I’m updating has a unique auto id which is the primary key.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:05:53+00:00Added an answer on May 12, 2026 at 7:05 am

    The first thing to do in diagnosing dynamically created SQL is to examine the SQL string actually created. However using a dynamic cursor to perform updates is not a good way to acheive an update for a row.

    Use an ADODB.Command object instead and create an Update command. Note don’t concatenate the values into the created SQL command. Instead use parameter place marks (usually ? but I can’t remember if that varies my DBengine (I’m not a mySQL bod)) and add parameters to the ADODB.Command parameters collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have encountered a difficulty in understanding the subroutine syntax. using the following code:
I have the following subroutine that is used to find $a0 to the power
I have C++ code in file test-Q.cpp that calls a Fortran subroutine in file
I'm a bit messed up with the following: I have a function that calls
I have following source. In insertMessage(..), it calls selectMessage to check whether duplicate record
I have following script that executes all the .reg files in the current directory.
I have following nested objects. I am using @Valid for validation in my controller.
I have a classic ASP page, which includes a server side in the section
I have the following FORTRAN SUBROUTINE SETPATHS(INPUT) !DEC$ ATTRIBUTES DLLEXPORT::SetPaths CHARACTER*20 INPUT CHARACTER*20 DIRECTORY
I have the following FORTRAN: SUBROUTINE MYSUB(MYPARAM) !DEC$ ATTRIBUTES DLLEXPORT::SetPaths CHARACTER*50 MYPARAM WRITE(6, *)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.