If you use a batch processing SQL statement to retrieve multiple tables and fill in dataset, the first table is named by the table name specified to the fill method. The following table is named by adding a number starting from 1 and increasing to 1 to the table name specified for the fill method. For exampleCode:
'Visual basic
Dim da As sqldataadapter = new sqldataadapter ("select * from MERs MERS; select * from orders;", myconnection)
Dim ds as dataset = new dataset ()
Da. Fill (DS, "MERs ")
// C #
Sqldataadapter da = new sqldataadapter ("select * from MERs MERS; select * from orders;", myconnection );
Dataset DS = new dataset ();
Da. Fill (DS, "MERs ");
After filling in the dataset, you can easily change the tablename attribute of the customers1 table to "orders ". However, subsequent filling will cause the "MERs" table to be refilled, while the "orders" table will be ignored and another "customers1" table will be created. To remedy this situation, create a ableablemapping, map "customers1" to "orders", and create other table mappings for other tables. For example:
'Visual basic
Dim da As sqldataadapter = new sqldataadapter ("select * from MERs MERS; select * from orders;", myconnection)
Da. tablemappings. Add ("customers1", "orders ")
Dim ds as dataset = new dataset ()
Da. Fill (DS, "MERs ")
// C #
Sqldataadapter da = new sqldataadapter ("select * from MERs MERS; select * from orders;", myconnection );
Da. tablemappings. Add ("customers1", "orders ");
Dataset DS = new dataset ();
Da. Fill (DS, "MERs ");