The Upgrade Toolkit objects that shipped with Microsoft Dynamics NAV 2013 have a good example of code that works directly with SQL Server through the .NET Framework library. On the product media, navigate to this location:
..UpgradeToolKitData Conversion Tools601
Import the
Upgrade 601700.2.fob file. This contains codeunit 104050
Upgrade - SQL Mgt.:
and codeunit 104049
Upgrade Dimension entry - SQL:
The same code structure should be applicable to Microsoft Dynamics NAV 2009 R2, though only for the RoleTailored client.
I hope this helps you create codeunits that connect to SQL Server through .NET Interop.
Best regards,
Alexey Finogenov

Источник:
http://feedproxy.google.com/~r/Micro...t-interop.aspx