Multiple
SELECT
statements can be sent to the database server in a single request. The problem here is that the tables generated from the queries have automatic names
Table
and
Table1
. However, the generated table names can be mapped to names that should be used in the DataSet.
SqlDataAdapter adapter = new SqlDataAdapter(
"SELECT * FROM Customers; SELECT * FROM Orders", connection);
adapter.TableMappings.Add("Table", "Customer");
adapter.TableMappings.Add("Table1", "Order");
adapter.Fill(ds);