Teach Yourself Visual Studio® .NET 2003 in 21 Days [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Teach Yourself Visual Studio® .NET 2003 in 21 Days [Electronic resources] - نسخه متنی

Jason Beres

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید









Q&A








Q1:

I don't get it. Why doesn't a DataReader support databinding on Windows Forms? It seems like so much less code to write!


A1:

It's true that using DataReaders amounts to writing less code. To bind to a control in Windows Forms, the class must expose the IList or IListSource interface of the System.ComponentModel namespace. A DataReader is an unbuffered stream of data that does not support these interfaces.

Q2:

You kept mentioning scalability. How can I achieve maximum performance and scalability in my data access applications?


A2:

Even though applications might be hindered by the hardware they're running on, writing efficient code also makes a big difference. Follow these tips to maximize your code performance:


  • Always open database connections as late as possible and close them as early as possible.


  • Use DataReaders for read-only forward-only data access as much as possible. DataReaders are the most efficient way to access data from a database in .NET.


  • Don't pass large DataSet objects over the network. Doing so affects the network performance, which in turn affects your application performance.


  • Use stored procedures for all Selects, Inserts, Updates, and Deletes. Stored procedures are compiled in SQL Server, whereas ad hoc queries aren't. Using stored procedures improves data access performance.


Q3:

I keep getting errors when I attempt to reuse a connection object after I implement a DataReader. Why?


A3:

Each time a DataReader is associated with a Connection object, the relationship is exclusive until you explicitly close the DataReader object using the Close method of the DataReader. Doing so releases the Connection object for reuse with another Command object.

To get more information online, open the following link. It takes you to the Diving Into Data Access column of the Microsoft Developers Network (MSDN).

http://www.msdn.microsoft.com/library/en-us/dndive/html/data06132002.asp

This series of articles gives you tons of great examples on different data access techniques, and discusses more advanced topics such as handling multiple tables in a DataSet and how to manage relationships in a DataSet.


/ 270