RE: Visual Basic 2005.Net TableAdapters

Tech-Archive recommends: Fix windows errors by optimizing your registry



I think my question may not have been clear enough. When I initially create a
TableAdapter I select a table, which returns all the records. Now, in some
training materials I have been going through, they suggest I use the Query
Builder to add filter logic to the script. Thus, I load the TableAdapters
Query Builder and add "WHERE CustomerID = @CustomerID" so that the Table
Adapter will only display recurds for the current customer selected. My
question is, in MS Access, the process would pull over all the data and then
filter it. But, in the case of SQL Server, the processing takes place on the
server and only returns the resultset. So, in this case, does the
TableAdapter pull over all the records and then filter the resultset, or are
only the resultset being returned?

Thank You.

"Linda Liu [MSFT]" wrote:

Hi Greg,

What I'm wonder is, does this TableAdapter work in the same manner as a
SQL Server Stored Procedure or View?

No, TableAdapter doesn't work in the same manner as a SQL Server Stored
Procedure or View. In fact, they are different concept.

A stored procedure consists of several SQL statements and compiled on the
SQL Server. A view is based on a table and has some filter conditions. Both
of them reside in database.

TableAdapters provide communication between your application and a
database. More specifically, a TableAdapter connects to a database,
executes queries or stored procedures, and either returns a new data table
populated with the returned data or fills an existing DataTable with the
returned data. TableAdapters are also used to send updated data from your
application back to the database.

does it work like MS Access where it pulls all the data over and then
filters it?

No, TableAdapter pulls the data and fill the returned data into a
DataTable. It doesn't filter the data. If you'd like to filter the data in
a DataTable, you could use a BindingSource or DataView to do it. The
following is a sample:

Dim table As New DataTable
Dim view As New DataView(table)
view.RowFilter = "ID> 1"

-or-

Dim bs As New BindingSource(table, "")
bs.Filter = "ID > 1"

should I be making my data sources for the TableAdapters stored procedures
and Views instead?

TableAdapters can connect to a stored procedure or view to retrieve data
from database. In this case, you needn't config the complex queries by
yourself to retrieve the data and it will be more efficient when retrieving
data from database.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


.



Relevant Pages

  • Gefilterte daten aus Dataset-Tabelle
    ... Wenn ich nun aber aus einer Tabelle der DB (per TableAdapter) nur gewisse ... Abfrage (SQL) dem entsprechenden Adapter hinzufuege, ... Abfrage-Generator anwerfe und als Filter zum Beispiel Spalte1 und Spalte2 ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: Strongly typed datasets: Can table adapter handle multiple resultsets?
    ... But the tableadapter handles in this case everytime single resultsets and therefore it is another situation then your question. ... DataTables in a DataSet. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Strongly typed datasets: Can table adapter handle multiple resultsets?
    ... I agree that we cannot configure TableAdaper code to handle multiple resultset and we have to extend it. ... But the tableadapter handles in this case everytime single resultsets and therefore it is another situation then your question. ... DataTables in a DataSet. ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: SqlCacheDependency and ObjectDataSource
    ... underlying SqlCommand object is encapsulated by TableAdapter. ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: ASP.Net website structure - TableAdapters and a Class Library
    ... ASP.NET web application since the TableAdapter will still refer to the ... why the TableAdapter will reference the connectionstringat ... this can be done through override the connectionString in the ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet)