There is also a method on the DbDataSourceItem object that creates new connections that can be used with the data source.Dim loConnection As SqlConnection = DataLayer.DataSources("").CreateBlankDbConnection()
loConnection.Open()
'-- Do work
loConnection.Close()
You can also access a DbDataSourceItem from the DataSources collection by either key or by index. Generally, you will want to use the key (string value) to retrieve the data source, as you never know what order the data sources are in. If you only have one data source (generally you will), then you can access it fine by either DataSources("") or DataSources(0).