Dim adapter As new System.Data.OleDb.OleDbDataAdapter()
Dim select As New System.Data.OleDb.OleDbCommand()
Dim connection As New System.Data.OleDb.OleDbConnection()
Dim data As New DataSet()
connection.ConnectionString = DatabaseTools.GetNorthwindConnectionString()
select.CommandText = "SELECT Orders.OrderDate, Customers.CompanyName, Products.ProductName, [Order Details].Quantity * [Order Details].UnitPrice AS ProductAmount FROM (((Orders INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID) INNER JOIN Products ON [Order Details].ProductID = Products.ProductID) ORDER BY OrderDate"
select.Connection = connection
adapter.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {
New System.Data.Common.DataTableMapping("Table", "Orders", New System.Data.Common.DataColumnMapping() {
New System.Data.Common.DataColumnMapping("OrderDate", "OrderDate"),
New System.Data.Common.DataColumnMapping("CompanyName", "CompanyName"),
New System.Data.Common.DataColumnMapping("ProductName", "ProductName"),
New System.Data.Common.DataColumnMapping("ProductAmount", "ProductAmount")})})
adapter.SelectCommand = select
adapter.FillSchema( data, SchemaType.Source, "Orders" )
adapter.Fill( data )