July 2002
Beginner
720 pages
14h 35m
English
We already know that the DataSet contains a collection of tables. To access the tables in the DataSet we use the following syntax:
DS.Tables.Item("Employees") or
DS.Tables.Item("Customers") For example, to find the figure returned for the query about how many rows a table has, we can use the following code:
Cust_DA = New SqlDataAdapter("SELECT * FROM Customers", _
"server=localhost;database=Northwind;uid=sa;pwd=;")
Cust_DA.Fill(DS, "Customers")
Cust = DS.Tables.Item("Customers")
Console.WriteLine(Cust.TableName & " contains " & _
Cust.Rows.Count & " record(s)") Each item in the Tables collection is of a DataTable type. In the previous example, we used the Rows collection of the DataTable to find out how ...
Read now
Unlock full access