Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Upgrade VB6 Database to VB10

Upgrade VB6 Database to VB10

Scheduled Pinned Locked Moved Visual Basic
databasetutorialquestion
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Garner T
    wrote on last edited by
    #1

    I wrote a large Database program in VB6 that worked well for many years. Now I am trying to re-write that program in VB10. I was able to figure out how to make everything work except for the main element, the Database controls. Is there something that I can read to learn how the new code works? Thanks, Garner

    R A 2 Replies Last reply
    0
    • G Garner T

      I wrote a large Database program in VB6 that worked well for many years. Now I am trying to re-write that program in VB10. I was able to figure out how to make everything work except for the main element, the Database controls. Is there something that I can read to learn how the new code works? Thanks, Garner

      R Offline
      R Offline
      RobCroll
      wrote on last edited by
      #2

      When you say Database controls, are you talking about UI or at a data access level. An example code snippet would also help answer your question.

      "You get that on the big jobs."

      G 1 Reply Last reply
      0
      • R RobCroll

        When you say Database controls, are you talking about UI or at a data access level. An example code snippet would also help answer your question.

        "You get that on the big jobs."

        G Offline
        G Offline
        Garner T
        wrote on last edited by
        #3

        Now I think I’m worse off than I originally thought since I don’t even know how to answer your question. Guessing “UI” means “User Interface?” If so, I think that is where my problem is. Here’s the old VB6 code I used for my “Update” button in the user interface. VB10 highlights just about all of it with all kinds of errors. The worst part is that I have several buttons in each of several interfaces controlling several databases. “Add,” “Update,” “Delete,” & “Refresh” are the buttons that I am using. Private Sub cmdUpdate_Click() On Error GoTo UpdateErr Dim db As Database Set db = OpenDatabase("c:\microsoft visual studio\vb98\openaccts.mdb") Dim rs As Recordset Set rs = db.OpenRecordset("prices", dbOpenDynaset) 'Edit record and show new prices. rs.Edit rs.Fields("1b") = txtFields(0) rs.Fields("2b") = txtFields(1) rs.Fields("2r") = txtFields(2) rs.Fields("3a") = txtFields(3) rs.Fields("3s") = txtFields(4) rs.Fields("as") = txtFields(5) rs.Fields("br") = txtFields(6) rs.Fields("bs") = txtFields(7) rs.Fields("fd") = txtFields(8) rs.Fields("ms") = txtFields(9) rs.Fields("os") = txtFields(10) rs.Fields("ts") = txtFields(11) rs.Fields("tu") = txtFields(12) rs.Fields("ws") = txtFields(13) rs.Update 'Change prices on PRODUCT form. frmprdm!txt1b.text = rs.Fields("1b") frmprdm!txt2b.text = rs.Fields("2b") frmprdm!txt3a.text = rs.Fields("3a") frmprdm!txt3u.text = rs.Fields("3s") frmprdm!txtas.text = rs.Fields("as") frmprdm!txtbr.text = rs.Fields("br") frmprdm!txtbs.text = rs.Fields("bs") frmprdm!txtfd.text = rs.Fields("fd") frmprdm!txtms.text = rs.Fields("ms") frmprdm!txtou.text = rs.Fields("os") frmprdm!txtts.text = rs.Fields("ts") frmprdm!txttu.text = rs.Fields("tu") frmprdm!txtws.text = rs.Fields("ws") Exit Sub UpdateErr: MsgBox Err.Description End Sub I have read a ton of information online about changing the code and; so far, none of it has worked for me. Thanks, Garner

        C R 2 Replies Last reply
        0
        • G Garner T

          Now I think I’m worse off than I originally thought since I don’t even know how to answer your question. Guessing “UI” means “User Interface?” If so, I think that is where my problem is. Here’s the old VB6 code I used for my “Update” button in the user interface. VB10 highlights just about all of it with all kinds of errors. The worst part is that I have several buttons in each of several interfaces controlling several databases. “Add,” “Update,” “Delete,” & “Refresh” are the buttons that I am using. Private Sub cmdUpdate_Click() On Error GoTo UpdateErr Dim db As Database Set db = OpenDatabase("c:\microsoft visual studio\vb98\openaccts.mdb") Dim rs As Recordset Set rs = db.OpenRecordset("prices", dbOpenDynaset) 'Edit record and show new prices. rs.Edit rs.Fields("1b") = txtFields(0) rs.Fields("2b") = txtFields(1) rs.Fields("2r") = txtFields(2) rs.Fields("3a") = txtFields(3) rs.Fields("3s") = txtFields(4) rs.Fields("as") = txtFields(5) rs.Fields("br") = txtFields(6) rs.Fields("bs") = txtFields(7) rs.Fields("fd") = txtFields(8) rs.Fields("ms") = txtFields(9) rs.Fields("os") = txtFields(10) rs.Fields("ts") = txtFields(11) rs.Fields("tu") = txtFields(12) rs.Fields("ws") = txtFields(13) rs.Update 'Change prices on PRODUCT form. frmprdm!txt1b.text = rs.Fields("1b") frmprdm!txt2b.text = rs.Fields("2b") frmprdm!txt3a.text = rs.Fields("3a") frmprdm!txt3u.text = rs.Fields("3s") frmprdm!txtas.text = rs.Fields("as") frmprdm!txtbr.text = rs.Fields("br") frmprdm!txtbs.text = rs.Fields("bs") frmprdm!txtfd.text = rs.Fields("fd") frmprdm!txtms.text = rs.Fields("ms") frmprdm!txtou.text = rs.Fields("os") frmprdm!txtts.text = rs.Fields("ts") frmprdm!txttu.text = rs.Fields("tu") frmprdm!txtws.text = rs.Fields("ws") Exit Sub UpdateErr: MsgBox Err.Description End Sub I have read a ton of information online about changing the code and; so far, none of it has worked for me. Thanks, Garner

          C Offline
          C Offline
          ChandraRam
          wrote on last edited by
          #4

          Read up on DataTables, DataSets and DataRows - that should help. :)

          1 Reply Last reply
          0
          • G Garner T

            I wrote a large Database program in VB6 that worked well for many years. Now I am trying to re-write that program in VB10. I was able to figure out how to make everything work except for the main element, the Database controls. Is there something that I can read to learn how the new code works? Thanks, Garner

            A Offline
            A Offline
            Abhinav S
            wrote on last edited by
            #5

            Implementation of ADO.Net is different from ADO, so you will need to read about ADO.Net and learn it before using it.

            The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.

            G 1 Reply Last reply
            0
            • A Abhinav S

              Implementation of ADO.Net is different from ADO, so you will need to read about ADO.Net and learn it before using it.

              The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.

              G Offline
              G Offline
              Garner T
              wrote on last edited by
              #6

              I pretty much figured out that everything was different when none of my code worked anymore and nothing that I did helped. That was pretty much my original question. What do I read and where do I find it? I have read stuff online for hours in forums, MSDN, sample code ...? I have looked for books on the subject but I haven't found anything that seems like it would help. In VB6 I went to the book store, picked up a book, "Visual Basic 6 Database Programming," and everything I needed was there. No such luck with VB10.

              L 1 Reply Last reply
              0
              • G Garner T

                Now I think I’m worse off than I originally thought since I don’t even know how to answer your question. Guessing “UI” means “User Interface?” If so, I think that is where my problem is. Here’s the old VB6 code I used for my “Update” button in the user interface. VB10 highlights just about all of it with all kinds of errors. The worst part is that I have several buttons in each of several interfaces controlling several databases. “Add,” “Update,” “Delete,” & “Refresh” are the buttons that I am using. Private Sub cmdUpdate_Click() On Error GoTo UpdateErr Dim db As Database Set db = OpenDatabase("c:\microsoft visual studio\vb98\openaccts.mdb") Dim rs As Recordset Set rs = db.OpenRecordset("prices", dbOpenDynaset) 'Edit record and show new prices. rs.Edit rs.Fields("1b") = txtFields(0) rs.Fields("2b") = txtFields(1) rs.Fields("2r") = txtFields(2) rs.Fields("3a") = txtFields(3) rs.Fields("3s") = txtFields(4) rs.Fields("as") = txtFields(5) rs.Fields("br") = txtFields(6) rs.Fields("bs") = txtFields(7) rs.Fields("fd") = txtFields(8) rs.Fields("ms") = txtFields(9) rs.Fields("os") = txtFields(10) rs.Fields("ts") = txtFields(11) rs.Fields("tu") = txtFields(12) rs.Fields("ws") = txtFields(13) rs.Update 'Change prices on PRODUCT form. frmprdm!txt1b.text = rs.Fields("1b") frmprdm!txt2b.text = rs.Fields("2b") frmprdm!txt3a.text = rs.Fields("3a") frmprdm!txt3u.text = rs.Fields("3s") frmprdm!txtas.text = rs.Fields("as") frmprdm!txtbr.text = rs.Fields("br") frmprdm!txtbs.text = rs.Fields("bs") frmprdm!txtfd.text = rs.Fields("fd") frmprdm!txtms.text = rs.Fields("ms") frmprdm!txtou.text = rs.Fields("os") frmprdm!txtts.text = rs.Fields("ts") frmprdm!txttu.text = rs.Fields("tu") frmprdm!txtws.text = rs.Fields("ws") Exit Sub UpdateErr: MsgBox Err.Description End Sub I have read a ton of information online about changing the code and; so far, none of it has worked for me. Thanks, Garner

                R Offline
                R Offline
                RobCroll
                wrote on last edited by
                #7

                As mentioned ADO.NET is different to ADO but looking at that code I would recommend you may do well to use Entity Framework. It will abstract away a lot of the implementation and should fit quite nicely with your current model. Julie Lerman has created a great beginners guide screencast. If you want to get up and running fast, I'd go straight to EF - Part 1 section. Enjoy

                "You get that on the big jobs."

                1 Reply Last reply
                0
                • G Garner T

                  I pretty much figured out that everything was different when none of my code worked anymore and nothing that I did helped. That was pretty much my original question. What do I read and where do I find it? I have read stuff online for hours in forums, MSDN, sample code ...? I have looked for books on the subject but I haven't found anything that seems like it would help. In VB6 I went to the book store, picked up a book, "Visual Basic 6 Database Programming," and everything I needed was there. No such luck with VB10.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Here's a link to Amazon.com ADO.NET on Amazon[^] Some in the list are specific for VB. Julia Lerman's book is also mentioned and, like Rob above, I would recommend going the Entity Framework route as you then have an abstraction layer over the ADO.NET itself.

                  It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca

                  G 1 Reply Last reply
                  0
                  • L Lost User

                    Here's a link to Amazon.com ADO.NET on Amazon[^] Some in the list are specific for VB. Julia Lerman's book is also mentioned and, like Rob above, I would recommend going the Entity Framework route as you then have an abstraction layer over the ADO.NET itself.

                    It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca

                    G Offline
                    G Offline
                    Garner T
                    wrote on last edited by
                    #9

                    Thanks everyone for all of the information! Now I will have to see if my mind can absorb enough of it to make my code work. If not I know where to come for more help. Thanks again, Garner

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups