Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best method of retrieving database contents? 1

Status
Not open for further replies.

ioseph

Programmer
Sep 6, 2005
11
GB
Hi,
I have a web page and have about 10 text boxes to populate with data from a sql database. Can someone recommend the best way to pull all the contents out and place them in the correct fields at the same time. I would prefer not to write loads of select and execute scalar statements.
Thanks
 
There's easy (dataset) and there's scalable (parameterized SQL). Pick one.

Seriously, using a dataset to retreive a few rows can result in 4.6mb of memory being used at runtime, while parameterized SQL can be as little as 18kb (this was in an interview with some guys in Microsoft Germany on Enterprise integration). Also, a dataset will result in larger-grained locks being used within the database, as it's updating an entire row at a time, and not just the columns that changed (which might only require a row-level lock, and not a page-level lock which will affect other users).

So far as populating the fields -- it's just a series of copy statements. Copy from a database field (checking for null if needed), and stuff it into the field. Do the reverse when saving.

Chip H.


____________________________________________________________________
Donate to Katrina relief:
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top