|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 OLEDBDataAdapter, 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" <anil-l***@icinema.com> wrote in No not really - only because you're not used to it yet.news:#eRySSX5GHA.1200@TK2MSFTNGP02.phx.gbl: > This .Net Database stuff is way too complicated. Just to make a > Select statement on an Access database, I have to first get a Yes, it's quite a few lines, but you can wrap everything in a data layer.> connection string, then open a connection to the database, then create > an OLEDBConnection, then an OLEDBDataAdapter, 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 Yes, you can reuse the connection. Depending on the database, a single > 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? 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 : ) |
|||||||||||||||||||||||