posts - 30 , comments - 2 , trackbacks - 0

LINQ to QuickBooks

In this demo, we will demonstrate how to use LINQ to access tables in QuickBooks through the QuickBooks ADO.NET Data Provider. To do this we will LINQ to Entity Framework, which is used to generate the connection and can be used with any RSSBus ADO.NET Data Providers to access data via LINQ.

  • Step 1: Open Visual Studio and create a new project.
  • Step 2: Right click on the project and choose to add a new item. Select to add an ADO.NET Entity Data Model.
  • Step 3: Choose to generate from database and click next.
  • Step 4: Add a new Data Connection, and change your data source type to "RSSBus QuickBooks Data Source".
  • Step 5: Enter your data source connection information.
  • Step 6: If saving your entity connection to App.Config, set an entity name. In this example we are setting QuickBooksEntities as our entity connection to App.Config.
  • Step 7: Select any tables or views you would like to include in the model in addition to a model name.

Using the entity you created in Step 6, you can now perform Select, Update, Delete, and Insert commands. For example:

QuickBooksEntities qbeContext = new QuickBooksEntities();

var invoiceQuery = from invoice in qbeContext.Invoices
	orderby invoice.CustomerName
	select invoice;

foreach (var result in invoiceQuery) {
	Console.WriteLine("{0} {1} ", result.ID, result.CustomerName);
}

Print | posted on Thursday, April 26, 2012 3:11 AM |

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: