data adapters fill method

janilane

Active member
Joined
Jan 23, 2008
Messages
30
Programming Experience
Beginner
just wondering, if the Fill method is working without table parameters, how come we always put a table name? Please see sample taken from MSDN. This example already has a select statement to build the query string passed to the adapter, why is the second parameter needed?

Thanks


' Assumes that connection is a valid SqlConnection object.
Dim queryString As String = _
"SELECT CustomerID, CompanyName FROM dbo.Customers"
Dim adapter As SqlDataAdapter = New SqlDataAdapter( _
queryString, connection)

Dim customers As DataSet = New DataSet
adapter.Fill(customers, "Customers")
If Im right and to answer my question, the "customers" (2nd argument) is only for a new name tag to the table just in case it will be used again in the code?
 
name tag to the table
That is correct. There are many Fill methods, if you use the one Fill(DataSet) a default table name assignment of "Table" is used, that is what the documentation says.

Thread was splitted, your new topic "Update requires a valid UpdateCommand ?" request was moved to new thread. Please stay on topic in thread..
 
Back
Top