Multiple DB Selects require multiple connections?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anil Gupte

    #1

    Multiple DB Selects require multiple connections?

    This .Net Database stuff is way too complicated. Just to make a Select
    statement on an Access database, I have to first get a connection string,
    then open a connection to the database, then create an OLEDBConnection , then
    an OLEDBDataAdapte r, then a Dataset and then actually use the data. I
    counted 12 statements before I can actually populate a Label with some data!
    Or am I missing something?

    OK, so the real question is, if I need to make a second Select satement, do
    I need to go through this whole process all over again starting from opening
    a DB connection? What about Update commands? Can I do a Select and an
    Update on the same dataset?

    Thanx for your input.
    --
    Anil Gupte
    Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

    www.icinema.com


  • Spam Catcher

    #2
    Re: Multiple DB Selects require multiple connections?

    "Anil Gupte" <anil-list@icinema.co mwrote in
    news:#eRySSX5GH A.1200@TK2MSFTN GP02.phx.gbl:
    This .Net Database stuff is way too complicated.
    No not really - only because you're not used to it yet.


    Just to make a
    Select statement on an Access database, I have to first get a
    connection string, then open a connection to the database, then create
    an OLEDBConnection , then an OLEDBDataAdapte r, then a Dataset and then
    actually use the data. I counted 12 statements before I can actually
    populate a Label with some data! Or am I missing something?
    Yes, it's quite a few lines, but you can wrap everything in a data layer.

    OK, so the real question is, if I need to make a second Select
    satement, do I need to go through this whole process all over again
    starting from opening a DB connection? What about Update commands?
    Can I do a Select and an Update on the same dataset?
    Yes, you can reuse the connection. Depending on the database, a single
    connection may serialize the commands (i.e. multiple commands may not run
    at the same time), but if this is not a problem for you (as most commands
    only take a couple seconds to return), a single connection is A-OK.

    BTW, take a look at LLBLGen and similar O/R mappers (.NET teirs, etc), they
    map the database into a set of objects and make working with database much
    nicer : )

    Comment

    Working...