Updating an ADO Recordset


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: Updating an ADO Recordset

  1. #1
    Craig Guest

    Updating an ADO Recordset


    I am tying to update an ADO recordset and I keep getting an error -2147467259,
    Insufficient key column information for updating or refreshing.

    Here is my recordset open:
    adoActualRS.Open AQuery, ab, adOpenStatic, adLockOptimistic

    and the update statement:
    adoActualRS!TotalYearASP = BudASP
    adoActualRS![2000PlanTons] = BudTon
    adoActualRS.Update

    Any ideas as to why it isn't working??


  2. #2
    Marky Mark Guest

    Re: Updating an ADO Recordset


    "Craig" <craig.bielefeld@martinmarietta.com> wrote:
    >
    >I am tying to update an ADO recordset and I keep getting an error -2147467259,
    >Insufficient key column information for updating or refreshing.
    >
    >Here is my recordset open:
    >adoActualRS.Open AQuery, ab, adOpenStatic, adLockOptimistic
    >
    >and the update statement:
    >adoActualRS!TotalYearASP = BudASP
    >adoActualRS![2000PlanTons] = BudTon
    >adoActualRS.Update
    >
    >Any ideas as to why it isn't working??
    >



    Craig,

    It looks to me like the source of your problem lies in the connectstring
    property of your connection most likely.







  3. #3
    Marko Sink Guest

    Re: Updating an ADO Recordset


    "Craig" <craig.bielefeld@martinmarietta.com> wrote:
    >
    >I am tying to update an ADO recordset and I keep getting an error -2147467259,
    >Insufficient key column information for updating or refreshing.
    >
    >Here is my recordset open:
    >adoActualRS.Open AQuery, ab, adOpenStatic, adLockOptimistic
    >
    >and the update statement:
    >adoActualRS!TotalYearASP = BudASP
    >adoActualRS![2000PlanTons] = BudTon
    >adoActualRS.Update
    >
    >Any ideas as to why it isn't work


    Instead of parameter adOpenStatic, You should use: adOpenKeyset.


  4. #4
    Craig Guest

    Re: Updating an ADO Recordset


    "Marko Sink" <mare.sink@mailcity.com> wrote:
    >
    >"Craig" <craig.bielefeld@martinmarietta.com> wrote:
    >>
    >>I am tying to update an ADO recordset and I keep getting an error -2147467259,
    >>Insufficient key column information for updating or refreshing.
    >>
    >>Here is my recordset open:
    >>adoActualRS.Open AQuery, ab, adOpenStatic, adLockOptimistic
    >>
    >>and the update statement:
    >>adoActualRS!TotalYearASP = BudASP
    >>adoActualRS![2000PlanTons] = BudTon
    >>adoActualRS.Update
    >>
    >>Any ideas as to why it isn't work

    >
    >Instead of parameter adOpenStatic, You should use: adOpenKeyset.
    >

    I tried that and I still get the same error message.
    I am just trying to update two fields in the recordset.

  5. #5
    Craig Guest

    Re: Updating an ADO Recordset


    "Marky Mark" <mew@home.com> wrote:
    >
    >"Craig" <craig.bielefeld@martinmarietta.com> wrote:
    >>
    >>I am tying to update an ADO recordset and I keep getting an error -2147467259,
    >>Insufficient key column information for updating or refreshing.
    >>
    >>Here is my recordset open:
    >>adoActualRS.Open AQuery, ab, adOpenStatic, adLockOptimistic
    >>
    >>and the update statement:
    >>adoActualRS!TotalYearASP = BudASP
    >>adoActualRS![2000PlanTons] = BudTon
    >>adoActualRS.Update
    >>
    >>Any ideas as to why it isn't working??
    >>

    >
    >
    >Craig,
    >
    > It looks to me like the source of your problem lies in the connectstring
    >property of your connection most likely.


    Here is how I setup my connection...
    Dim ab as new ADODB.Connection
    Set ab = new ADODB.Connection

    Is there something else I should be setting?

  6. #6
    Andrew Grillage Guest

    Re: Updating an ADO Recordset


    "Craig" <craig.bielefeld@martinmarietta.com> wrote in message
    news:38e1f8fa$1@news.devx.com...
    >
    > "Marky Mark" <mew@home.com> wrote:
    > >
    > >"Craig" <craig.bielefeld@martinmarietta.com> wrote:
    > >>
    > >>I am tying to update an ADO recordset and I keep getting an

    error -2147467259,
    > >>Insufficient key column information for updating or refreshing.
    > >>
    > >>Here is my recordset open:
    > >>adoActualRS.Open AQuery, ab, adOpenStatic, adLockOptimistic
    > >>
    > >>and the update statement:
    > >>adoActualRS!TotalYearASP = BudASP
    > >>adoActualRS![2000PlanTons] = BudTon
    > >>adoActualRS.Update
    > >>
    > >>Any ideas as to why it isn't working??
    > >>

    > >
    > >
    > >Craig,
    > >
    > > It looks to me like the source of your problem lies in the

    connectstring
    > >property of your connection most likely.

    >
    > Here is how I setup my connection...
    > Dim ab as new ADODB.Connection
    > Set ab = new ADODB.Connection
    >
    > Is there something else I should be setting?


    You should certainly remove the 'new' keyword from the declaration thus

    Dim ab as ADODB.Connection
    Set ab = new ADODB.Connection

    Andrew





  7. #7
    Joe_F Guest

    Re: Updating an ADO Recordset


    Tell me what the table structure looks like on the table you're trying to
    update? What is the primary key? How many columns exist on the table and
    are any set not to accept null values?

  8. #8
    Ralph Outcalt Guest

    Re: Updating an ADO Recordset


    "Craig" <craig.bielefeld@martinmarietta.com> wrote:
    >
    >I am tying to update an ADO recordset and I keep getting an error -2147467259,
    >Insufficient key column information for updating or refreshing.
    >
    >Here is my recordset open:
    >adoActualRS.Open AQuery, ab, adOpenStatic, adLockOptimistic
    >
    >and the update statement:
    >adoActualRS!TotalYearASP = BudASP
    >adoActualRS![2000PlanTons] = BudTon
    >adoActualRS.Update
    >
    >Any ideas as to why it isn't working??
    >


    Craig,

    You did not include the actual query string in your example. This may be
    something you know or have looked at but if you use the "*" instead of specifying
    the actual fields individually, you will get this error. I found out the
    hard way.

    Hope this helps,

    Ralph

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center