Enter DataSet
Author: yuchen
ADO + introduces the concepts of DataSet and DataView. DataSet is similar to a set of records because it can store one or more tables of data and their relationships ). DataView is one of the implementations of these tables, similar to the ADO record set. In the above example, our DataSet only saves one table: Upcoming, which will reside in the ASP + server control. You can add more tables to DataSet in the following ways.
* Redefine our SQL statements.
* Set the SelectCommand attribute of ADODataCommand to a new ADODataCommand.
* Call the FillDataSet method of ADODataCommand
The FillDataSet method saves the tables in the SQL query results to the DataSet that is passed to the method call. Adding another table will cause the following changes:
DscUpcoming = New ADODataSetCommand (strSQL, Connect. ConnectToDB ())
DscUpcoming. FillDataSet (dsUpcoming, "Upcoming ")
Redefinition of SQL statements
StrSQL = "SELECT * FROM Students"
Set the SelectCommand attribute of ADODataSetCommand
DscUpcoming. SelectCommand = New ADOCommand (strSQL, Connect. ConnectToDB ())
Use the FillDataSet method to add the result as a new table to DataSet.
DscUpcoming. FillDataSet (dsUpcoming, "Students ")
Now we have established a connection to the database and returned the data to the DataSet. However, we have not used the data.