Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Need help with VB , (updating recordset)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with VB , (updating recordset)

    Are you reading the database through an ODBC link? If so, make sure the ODBC link knows about a primary key on the file. If not, you have to create a primary index over the file in your vb program. Below is an example code for doint that:
    Code

  • #2
    Need help with VB , (updating recordset)

    Scott, THANK YOU FOR RESPONDING !!! Will you mind taking a look at my code ? do you still think I should create a primary index ? my 400 file is not keyed, I need to keep this file in rrn order. Thanks again, Julie
    Code

    Comment


    • #3
      Need help with VB , (updating recordset)

      Julie, I ran into this same issue. If the PF is not keyed, the ODBC recordset will not be updatable. What I had to do was to create a local MDB file so I could append the linked table to it, then create the primary index over it. The recordset is then updatable. There may be a way to add a primary key over the file in VB without using a local MDB but I don't know how to do that, so opted for the method described. If you want to check to see if the recordset you create is updatable, after you open the recordset, break the program and in the immediate window type: ?rs.Updatable (where rs is the name of the recordset object) and you will get True if it is updatable or False if not.

      Comment


      • #4
        Need help with VB , (updating recordset)

        Scott, Thanks again for your input and ideas. I will try your method of using local MDB and I will test the recordset to see if it's updatable. thank you !!!!!! Julie

        Comment


        • #5
          Need help with VB , (updating recordset)

          hi Scott, Just wanted to thank you for your help. I added a unique key to my as/400 file and my VB program is updating correctly now !! THANK YOU !!! Julie

          Comment


          • #6
            Need help with VB , (updating recordset)

            I am very new to VB and would appreciate any help or tips on the following problem that I am having. The VB program that I wrote does the following. It reads a file on the AS/400, I am using a recordset (selecting records that I need). I read the recordset (do until eof), for each record in the recordset, I call Crystal Report passing it the parm which is the file #. My VB program reads the file and prints the Crystal report just fine ! the problem started when I am now trying to update each record. The program runs and stops at certain times due to a "Run-time error '-2147467259 (80004005)": query-based update failed because the row to update could not be found. Is this a record lock problem ?? Does the Crystal report have anything to do with this ? again, this program works just fine until I am trying to update. The strange thing is... sometimes I get this update error (while the program has updated all the records it should), and other times... I get the error... and it didn't update all the records. I would appreciate any help with this. Thank you !!

            Comment


            • #7
              Need help with VB , (updating recordset)

              Way to go, Julie! That was my experience too. If you don't have a unique key, you have to "define" one to the local access database in order for ODBC to figure out what record to update.

              Comment

              Working...
              X