![]() |
VOOZH | about |
This article illustrates using LINQ to access tables within the SAS Data Sets via the CData ADO.NET Data Provider for SAS Data Sets. To achieve this, we will use LINQ to Entity Framework, which facilitates the generation of connections and can be seamlessly employed with any CData ADO.NET Data Providers to access data through LINQ.
See the help documentation for a guide to setting up an EF 6 project to use the provider.
Enter your data source connection information.
Set the following connection properties to connect to your SAS DataSet files:
While the driver is capable of pulling data from SAS DataSet files hosted on a variety of cloud data stores, INSERT, UPDATE, and DELETE are not supported outside of local files in this driver.
Set the Connection Type to the service hosting your SAS DataSet files. A unique prefix at the beginning of the URI connection property is used to identify the cloud data store and the remainder of the path is a relative path to the desired folder (one table per file) or single file (a single table). For more information, refer to the Getting Started section of the Help documentation.
Below is a typical connection string:
URI=C:/myfolder;
Using the entity you created, you can now perform select , update, delete, and insert commands. For example:
SASDataSetsEntities context = new SASDataSetsEntities();
var restaurantsQuery = from restaurants in context.restaurants
select restaurants;
foreach (var result in restaurantsQuery) {
Console.WriteLine("{0} {1} ", result.Id, result.name);
}
See "LINQ and Entity Framework" chapter in the help documentation for example queries of the supported LINQ.
Download a free trial of the SAS Data Sets Data Provider to get started:
Download NowLearn more:
👁 SAS Data Sets IconRapidly create and deploy powerful .NET applications that integrate with SAS Data Sets.