/ Published in: C#
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
Sage.Accounting.Application application = null;
try
{
application.Connect("3", "");
application.ActiveCompany = application.Companies[1];
// Create an instnace of the model I want - in this case "Sage 200 Accounts"
// Bind the connection
bool bound=model.BindConnection(null);
//Retrieve the context from the model
Sage.Accounting.DataModel.DataContext context=(Sage.Accounting.DataModel.DataContext)(model.ModelContext);
// The context for the Sage 200 Accounts model contains all of the entities you would expect
// in addition to many calculated fields and projections
context.SLCustomerAccounts.Select(
s=>new
{
s.SLCustomerAccountID,
s.CustomerAccountNumber,
s.CustomerAccountShortName,
s.AccountBalance,
s.CreditLimit,
s.SYSCurrencyID
}
)
.Dump();
}
catch (System.Exception exception)
{
exception.Message.Dump();
}
finally
{
if (application != null)
{
application.Disconnect();
}
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                