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. C#
  4. MySQL data connection

MySQL data connection

Scheduled Pinned Locked Moved C#
databasemysqlquestionannouncement
11 Posts 4 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.
  • X Offline
    X Offline
    xilefxilef
    wrote on last edited by
    #1

    I have a treeview that I populate with data from various tables in mysql db. I also update the tables based on user actions. I was wondering, is it more efficient to use a mysqlDataAdapter for this or just CommandText and MySql Reader for populating and then separate CommandText statements for updating?

    E P 2 Replies Last reply
    0
    • X xilefxilef

      I have a treeview that I populate with data from various tables in mysql db. I also update the tables based on user actions. I was wondering, is it more efficient to use a mysqlDataAdapter for this or just CommandText and MySql Reader for populating and then separate CommandText statements for updating?

      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #2

      A reader done right is usually, almost always, faster than a data adapter, dataset solution. In the cases where timings show a data adapter executing faster there is usually a flaw in logic. Where the Data Adapter and data set solutions are usually faster is in Dev/Time not run time.

      Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

      P R 2 Replies Last reply
      0
      • E Ennis Ray Lynch Jr

        A reader done right is usually, almost always, faster than a data adapter, dataset solution. In the cases where timings show a data adapter executing faster there is usually a flaw in logic. Where the Data Adapter and data set solutions are usually faster is in Dev/Time not run time.

        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        10!

        1 Reply Last reply
        0
        • X xilefxilef

          I have a treeview that I populate with data from various tables in mysql db. I also update the tables based on user actions. I was wondering, is it more efficient to use a mysqlDataAdapter for this or just CommandText and MySql Reader for populating and then separate CommandText statements for updating?

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          Avoid DataAdapters for real work; their only purpose is to allow MS demonstrators at launch events to produce a barely-working program in the time allowed.

          X 1 Reply Last reply
          0
          • E Ennis Ray Lynch Jr

            A reader done right is usually, almost always, faster than a data adapter, dataset solution. In the cases where timings show a data adapter executing faster there is usually a flaw in logic. Where the Data Adapter and data set solutions are usually faster is in Dev/Time not run time.

            Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

            R Offline
            R Offline
            Roger Wright
            wrote on last edited by
            #5

            While I wasn't looking for an answer to that question, it will certainly come in handy for a project I'm working on - one of several. Thanks! Is not a reader a one-way solution, though; that is, for reading from a database in one direction? And a data adapter is more of a random access solution? Such additional overhead would certainly explain the performance difference.

            "A Journey of a Thousand Rest Stops Begins with a Single Movement"

            E P 2 Replies Last reply
            0
            • R Roger Wright

              While I wasn't looking for an answer to that question, it will certainly come in handy for a project I'm working on - one of several. Thanks! Is not a reader a one-way solution, though; that is, for reading from a database in one direction? And a data adapter is more of a random access solution? Such additional overhead would certainly explain the performance difference.

              "A Journey of a Thousand Rest Stops Begins with a Single Movement"

              E Offline
              E Offline
              Ennis Ray Lynch Jr
              wrote on last edited by
              #6

              A common misconception. ADO.NET is exclusively a fast-forward, read-only cursor. The data adapter uses a data reader behind the scenes to get the data. What the data adapter does is attempt to infer the schema from the available result sets and then read to the end of all cursors populating a data set. You then get your data in a handy data set with associated overhead. AFAIK there is not an ADO.NET solution intended to maintain an open cursor to the DB at all.

              Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

              P R 2 Replies Last reply
              0
              • R Roger Wright

                While I wasn't looking for an answer to that question, it will certainly come in handy for a project I'm working on - one of several. Thanks! Is not a reader a one-way solution, though; that is, for reading from a database in one direction? And a data adapter is more of a random access solution? Such additional overhead would certainly explain the performance difference.

                "A Journey of a Thousand Rest Stops Begins with a Single Movement"

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                DataReaders underly all ADO.net access; including ExecuteScalar, ExecuteNonQuery, and DataAdapter.Fill and .Update Learning to use them effectively will make you a better developer. And chicks dig it. :cool:

                R 1 Reply Last reply
                0
                • E Ennis Ray Lynch Jr

                  A common misconception. ADO.NET is exclusively a fast-forward, read-only cursor. The data adapter uses a data reader behind the scenes to get the data. What the data adapter does is attempt to infer the schema from the available result sets and then read to the end of all cursors populating a data set. You then get your data in a handy data set with associated overhead. AFAIK there is not an ADO.NET solution intended to maintain an open cursor to the DB at all.

                  Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #8

                  with associated unnecessary overhead :-D

                  1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    DataReaders underly all ADO.net access; including ExecuteScalar, ExecuteNonQuery, and DataAdapter.Fill and .Update Learning to use them effectively will make you a better developer. And chicks dig it. :cool:

                    R Offline
                    R Offline
                    Roger Wright
                    wrote on last edited by
                    #9

                    PIEBALDconsult wrote:

                    And chicks dig it

                    Well, that's good enough for me! :-D

                    "A Journey of a Thousand Rest Stops Begins with a Single Movement"

                    1 Reply Last reply
                    0
                    • E Ennis Ray Lynch Jr

                      A common misconception. ADO.NET is exclusively a fast-forward, read-only cursor. The data adapter uses a data reader behind the scenes to get the data. What the data adapter does is attempt to infer the schema from the available result sets and then read to the end of all cursors populating a data set. You then get your data in a handy data set with associated overhead. AFAIK there is not an ADO.NET solution intended to maintain an open cursor to the DB at all.

                      Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. A man said to the universe: "Sir I exist!" "However," replied the universe, "The fact has not created in me A sense of obligation." --Stephen Crane

                      R Offline
                      R Offline
                      Roger Wright
                      wrote on last edited by
                      #10

                      Back to the books... :sigh:

                      "A Journey of a Thousand Rest Stops Begins with a Single Movement"

                      1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        Avoid DataAdapters for real work; their only purpose is to allow MS demonstrators at launch events to produce a barely-working program in the time allowed.

                        X Offline
                        X Offline
                        xilefxilef
                        wrote on last edited by
                        #11

                        thanks for all the info. I've been using DataReaders so far and just came across the adapter. So I'll stick with the reader.

                        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