Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Things i learned working with C# and Accpac

Status
Not open for further replies.

Adam007

Programmer
Oct 18, 2009
21
Hey All,

Recently I had to do a project using C# and inter operating with Accpac 5.5, I decided to post here to let everyone else know the hurtles i had to jump to get the project completed.

1) When using Accpac from C# (or VB.NET) you must make a reference to the COM component 'ACCPAC XAPI 1.1 Type Library' this will give you access to the xapiView, xapiFields and so on.

2) If your anything like me you hate the idea of having to use the stupid Accpac views to look for data, don't get me wrong they are nice for simple stuff but fall extremely short when you want to do pretty standard SQL queries (for the record i mean using Transact Structured Query Language not MS SQL). Well fear not, a new addition in 5.4 (and carried forward) is the 'CS0120' view. This view allows you to run complex SQL queries against an Accpac database, here is an example;

Code:
ACCPACXAPILib.xapiView Orders = null;

Orders = OpenView("CS0120");
string sql = "SELECT OEINVH.INVNUMBER, OEINVH.ORDDATE, ARCUS.LOCATION, OEINVH.CUSTOMER, OEINVH.PONUMBER, OEINVH.REFERENCE, OEINVH.INVUNIQ " +
                "FROM OEINVH " +
                "INNER JOIN ARCUS ON ARCUS.IDCUST = OEINVH.CUSTOMER " +
                "WHERE OEINVH.SHIPTRACK = '' AND ORDDATE > 20090818" ;

Orders.Browse(sql, 1);

while (Convert.ToBoolean(Orders.Fetch())){
  [Your code here]
}

3) to either update or add new records CREATE A MACRO IN ACCPAC FIRST, then simply convert that to C# (or VB.NET) just remember that you HAVE to compose all the views in order for your insert / updates to work.

these 3 simple tips should help you out, they really helped me out.
and if all else fails post your question here, there are some really great people here that will help you if they can (you know who you are ;) )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top