PDA

View Full Version : فرق TableAdapter و DataAdapter



bad_boy_2007
سه شنبه 09 مرداد 1386, 17:32 عصر
سلام دوستان
میشه راهنماییم کنید که فرق بین TableAdapter و DataAdapter چیه ؟ غیر از اینکه Table Adapter شئ Connection رو Encapsolate میکنه و لازم به باز کردن و بستن Connection نیست ؟

اَرژنگ
سه شنبه 09 مرداد 1386, 17:37 عصر
سلام دوستان
میشه راهنماییم کنید که فرق بین TableAdapter و DataAdapter چیه ؟ غیر از اینکه Table Adapter شئ Connection رو Encapsolate میکنه و لازم به باز کردن و بستن Connection نیست ؟


http://msdn2.microsoft.com/en-us/library/bz9tthwx(VS.80).aspx
Users of previous versions of Visual Studio can think of a TableAdapter as a DataAdapter (http://msdn2.microsoft.com/en-us/library/system.data.common.dataadapter(VS.80).aspx) with a built-in connection object and the ability to contain multiple queries. Each query added to a TableAdapter is exposed as a public method that is simply called like any other method or function on an object.

In addition to the standard functionality of a DataAdapter, TableAdapters provide additional typed methods that encapsulate queries that share a common schema with the associated typed DataTable. In other words, you can have as many queries as you want on a TableAdapter as long as they return data that conforms to the same schema.
In the previous version of Visual Studio, ADO.NET Data Adapters (http://msdn2.microsoft.com/en-us/library/tkctt675(VS.80).aspx) were used for communicating between an application and a database. While data adapters are still a main component of .NET Framework Data Providers (http://msdn2.microsoft.com/en-us/library/a6cd7c08(VS.80).aspx), TableAdapters are designer-generated components that improve upon the functionality of DataAdapters. TableAdapters typically contain Fill and Update methods to fetch and update data in a database.

bad_boy_2007
سه شنبه 09 مرداد 1386, 19:17 عصر
:گیج: ممنون ارژنگ عزیز لطف کردی وقت گزاشتی ولی من چیزی از این متن نفهمیدم میشه فارسی توضیح بدی :لبخند:

afshinfar
سه شنبه 20 مرداد 1388, 15:16 عصر
Salam
A DataAdapter is a Framework class used to construct untyped DataSet
objects by populating the Tables collection with the rowsets returned by
the SelectCommand. This class also supports an Update method that permits
you to define Update, Insert and Delete Commands for a single table. While
the DataAdapter can populate a DataSet with many tables, it can only make
changes to one of these--unless you jump through some hoops
A TableAdapter is a Visual Studio-generated class to generate strongly
typed DataTable classes--including code to update the DataTable. It is a
bindable mechanism to manage a single rowset--usually derived from a
SELECT against a single table.
While both of these mechanisms can be populated with the rowset returned
by a JOIN, they do not provide a means to update the root database
Table--as possible in some cases in ADO classic.

majid325
سه شنبه 20 مرداد 1388, 16:53 عصر
سلام دوستان
غیر از اینکه Table Adapter شئ Connection رو Encapsolate میکنه و لازم به باز کردن و بستن Connection نیست ؟

DataAdapter هم این کارو میکنه.

Sociant
سه شنبه 20 مرداد 1388, 21:13 عصر
از ترجمه متنی که ارژنگ گذاشتن اینطور میشه نتیجه گرفت :
1- میتوان TableAdapter را همان DataAdapter بعلاوه داشتن ارتباط درونی و قابلیت داشتن چند کوئری در نظر گرفت. (برای TableAdapter ها میشه به تعداد دلخواه کوئری تعریف کرد)
2- هر کوئری تعریف شده را می توان به صورت متد public فراخوانی کرد.
(کوئری هایی که میسازید با اسم کوئری بصورت متد از شی tableAdapterقابل دسترسی و فراخوانی میشوند)