Friday, 11 December 2015

Installing and Configuring Load balancer AOS - Dynamics AX 2012

Step to install Load balancer 
  • Install ‘n’-number of AOS required using product CD.
  • In my case I have installed 3 AOS – (2 will be a normal AOS and 1 AOS will act as Load balancer).
  • Important thing to remember is that 1 AOS always be act as Load balancer. Also there will be no license consumed by Load balancer
  • Below image shows list of services I have configured.


  • Have configured client configuration as listed below
  • After exporting the config file you will find all the AOS. Also remember to install the same config on all client systems
.
  • Go to System administration and do cluster configuration

Once the user get login you can see they are equally divided between AOS


















Monday, 9 November 2015

AX 2012 Client crash: System.Runtime.InteropServices.SEHException

Issue


When ever tried to open client got below error:

Application: Ax32.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.SEHException
Stack:
   at <Module>._wWinMainCRTStartup()

Resolution

Re-install the client

Tuesday, 3 November 2015

TFS integration with AX 2012 R3 CU8

Hi

For any issue with TFS integration with AX 2012 R3 CU8 refer below link

http://blogs.msdn.com/b/axsa/archive/2014/12/02/visual-studio-and-tfs-support-in-ax-2012-r3-cu8.aspx?CommentPosted=true#commentmessage

Happy day :)

Wednesday, 14 October 2015

AX 2012: Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics

 Issue: When i try to do full db sych i get following error:

"Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics"


Resolution:

Run below script on MicrosoftDyanmicsAX transaction db (not model db).

DECLARE @NetworkDomain nvarchar(300);
DECLARE @NetworkAlias nvarchar(300);
DECLARE @SID nvarchar(124);
DECLARE @InitialPartition BIGINT;

SELECT @InitialPartition=Recid FROM PARTITIONS WHERE PARTITIONKEY=N'Initial'

SELECT @NetworkAlias=NETWORKALIAS,@NetworkDomain=NETWORKDOMAIN,@SID=SID
FROM USERINFO
WHERE PARTITION=@InitialPartition AND ID = N'Admin'

UPDATE USERINFO
SET
NETWORKDOMAIN=@NetworkDomain,
NETWORKALIAS=@NetworkAlias,
SID=@SID

WHERE PARTITION != @InitialPartition AND ID = N'Admin'

Wednesday, 7 October 2015

AX 2012 DMF Issue - Could not load file or assembly 'Microsoft.SqlServer.ManagedDTS, Version=11.0.0.0

Hi

Recently i have done upgrade to CU8. Before import all the DMF imports where working fine. But once migrated to CU8 i was getting below error

Error:

Could not load file or assembly 'Microsoft.SqlServer.ManagedDTS, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.


Reason:

CU8 upgrade require Sql server 2014 and once you install SQL Server 2014 on you DB environment (Note: Previous version of my DMF install was working with SQL Server 2012 and it was working fine and prior to installing 2014 i have removed SQL 2012 version) the previous version of Microsoft Dynamics AX Data Import/Export Framework Service on SQL box was integrated with Microsoft.SqlServer.ManagedDTS, Version=11.0.0.0 Which is already removed from my system. Now you have to make Microsoft Dynamics AX Data Import/Export Framework Service to point Microsoft.SqlServer.ManagedDTS, Version=12.0.0.0.

Resolution

Reinstall "Microsoft Dynamics AX Data Import/Export Framework Service" on SQL Server box.


Happy day :)

Tuesday, 11 August 2015

EXPORT AX model - "Login failed for user '******'.,Microsoft.Dynamics.AX.Framework.Tools.ModelManagement.PowerShell.ExportAXModelCommand

While exporting AX model using Dynamics AX cmdlet following issue came



Resolution:

You dont have access to SQL DB. Provide an access to perform this operation

Friday, 24 July 2015

EP AX 2012: Using display method in dataSetLookup

Issue

dataSetLookup method uses sysDataSetLookup for is query purpose on EP front.
But when you compare with SysTableLookup it has a method addLookupMethod to add a display method if needed. So how to add a displaymethod is a big question ?


Resolution

Find below code to do it

void dataSetLookup(SysDataSetLookup sysDataSetLookup)
{

    container               recids;
    str                     recidstr;
    List                    list;
    Query queryHcmPosition = new query();
    list                   = new List(Types::String);
    SysTableLookup s   
    
    
    
    list.addEnd(fieldStr(HcmPosition, PositionId));

    // Add a display method from HcmPosition
    list.addEnd(tablemethodstr(HcmPosition,description) + '**');


    //Creating datasetlookup
    sysDataSetLookup.parmHideSelectField(false);
    sysDataSetLookup.parmAllowPaging(true);
    sysDataSetLookup.parmLookupFields(list);
    sysDataSetLookup.parmSelectField(fieldStr(HcmPosition, PositionId));

recid+=5215444646;
    // creating query for all position recids    queryHcmPosition.addDataSource(tableNum(HcmPosition)).addRange(fieldNum(HcmPosition,RecId)).value(con2Str(recids,","));
    sysDataSetLookup.parmQuery(queryHcmPosition);
}


Friday, 17 July 2015

AX2012 EP error : DataSource XXXX in DataSet XXXX has an unknown field XXXX

Cause of the issue: Change in table level field elements.(Adding a new field )

Resolution: 
Any change happen at table or dataset level must be reflected to VS EP project. Best way to do is

  • Try to refresh caches  in Development workspace go to
    • Tools > Caches > Refresh dictionary
    • Tools > Caches > Refresh data
    • Tools > Caches > Refresh elements
    • If it doesn't solve your problem try to close and reopen visual studio after you clear the caches.
  • Final try close all window and restart AOS.

Monday, 13 July 2015

AX 2012 TFS issue - Unable to check in. (Label file)

I was facing an issue while check-in label file.

Cause of issue
- MS Product bug.
- TFS Multiple check out option is set to false(This issue won't arise when this option is true).

Reason
When multiple check out option is set to false. TFS will lock (first instance of lock) the object so that any other developer will not be able to check-out the same. And while checkin the object AX code(Only for label files) will lock the object (second instance of lock) and do the checkin. But two locks cannot be performed on same object so system will throw issue. 


Resolution

I have debug the code and found that while check-in the label object, SysLabelFile.allowLockDuringCheckIn() method returns true but it must be implemented in the way  SysTreeNode.allowLockDuringCheckIn() class is implemented. We need to change allowLockDuringCheckIn method in SysLabelFile class to return “false” instead of “true”. Please find screen shot below









Checklist for TFS object management - AX 2012


  •  While check-in the object make sure it is in the correct MODEL.
  • All the object which are created or modified newly has to be add to version control.
  • All the developers must do a synch (don’t perform a Force synch it take more time) every morning when they arrive office.
  • Any EP development done with visual studio project must checked in properly.
  • When a developer make use of label file, he/she has to check-in the same along with the object where they used the label file else it will have improper labels.
  • I have seen people checking-out object for long time. Don’t check-out object for long time. Try to check-in an object ASAP after the development. If label file is used with the object then make sure it must be checked-in along with it.
  • If an object is added to version controls and it is renamed/deleted at later stage. Then same has to be deleted from TFS. And a mail has to send to developer so that object conflict will not occur while renaming it. Avoid renaming after check-in to TFS.
  • There must be a build server(Auto build configured). That will help developers to identify issue with build.
  • If possible make use of tfs branching.
  • Make sure multiple check-out option is false.

Friday, 10 July 2015

Enterprise Portal AX 2012: Unable to obtain exclusive access to the session cache

When i was opening newly developed enterprise portal page i was not able to render it for around 15-20 Mins and it was loading state. I haven't found any solution over internet. The error was


Resolution


  1. Check your SQL database drive have enough space. Mine was just 2.2 GB.(Might be not true it was in my case).
  2. Restart Sql Server services.


Please write your comments :)



Thursday, 14 May 2015

Configuring and opening Visual Studio which has multiple standalone AOS instance on same server

Steps to open a Visual studio pointing to a specific AOS environment
1. Go to client configuration and create a .axc file (For the instance to which AOS must be connected).
2. On the client computer that is running Visual Studio, open the Start menu, right-click Visual Studio 2010, and select Properties.
3. Update the Target field and add the /AxConfig switch as shown below

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /AxConfig "C:\AXConfig\AOS1AX.axc"



Tuesday, 12 May 2015

Dynamics AX EP Install issue : ISAPI Filter ‘C:\Windows\Microsoft.NET\Framework\v4.0.30319\\aspnet_filter.dll’ could not be loaded due to a configuration problem

EP Issue from Event viewer.

ISAPI Filter ‘C:\Windows\Microsoft.NET\Framework\v4.0.30319\\aspnet_filter.dll’ could not be loaded due to a configuration problem. The current configuration only supports loading images built for a AMD64 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.



Solution

Upon closer inspection of the error message I noticed the problem:


v4.0.30319\\aspnet_filter.dll

Windows doesn’t handle double slashes very well as opposed to Linux. What is strange is none of these settings are manually changed which suggests it was perhaps a Windows update that caused this, however I have no evidence beyond change control logs.

I fixed with the following process:


Opened IIS Manager and selected the IIS web server node:




In the middle pane, browse to the IIS section and select ISAPI Filters:




Expand the columns as required, looking for an Executable path with \\ in it, then click Edit:





From the above screenshot, change the \\ to \ so the path reads:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll

Dynamics AX Enterprise portal issue: Exception occurred on the metadata service on client or server. See exception details below:>Thread was being aborted.

EP Issue

An error has occurred while redirecting to the default home page set for the Enterprise Portal site http://****:14841/sites/DynamicsAx.  Microsoft Dynamics AX is ignoring this error and redirecting to default.aspx.
Exception occurred on the metadata service on client or server. See exception details below:
>Thread was being aborted.
Microsoft.Dynamics.AX.Framework.Services.Client.MetadataServiceException
   at Microsoft.Dynamics.AX.Framework.Services.Client.ServiceClientHelper.InvokeChannelOperation[TResult,TChannel](IServiceClient`1 client, Func`2 operationInvoker, Func`2 exceptionWrapper)
   at Microsoft.Dynamics.AX.Framework.Services.Client.MetadataServiceProxyFactory.<>c__DisplayClass54.<CreateWebMenuItemMetadataProxy>b__52()
   at Microsoft.Dynamics.AX.Framework.Services.Client.MetadataServiceProxyFactory.CreateWebMenuItemMetadataProxy(WebMenuItemKey webMenuItemKey)
   at Microsoft.Dynamics.AX.Framework.Services.Client.MetadataCache.<.cctor>b__46(String mainKey)
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.MetadataAccessorBase`2.GetItem(TKey key)
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Caching.ItemCache`2.<>c__DisplayClassc.<GetItemCustom>b__b()
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Caching.CacheBase.CacheRead(ICacheReadArgs cacheReadArgs, Action tryReadAction, Action readThroughAction)
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Caching.ItemCache`2.GetItemCustom(TKey key, Func`2 itemAccessor)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebMenuItemMetadata.GetWebMenuItemReferenceNode[T](ISession session, SysDictMenu menuItemReference)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebMenuMetadata.InitializeChildren(ISession session, SysDictMenu dictMenu, WebMenuMetadata webMenu)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebMenuMetadata.GetWebMenuMetadata(ISession session, SysDictMenu dictMenu, Boolean subMenu)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebMenuMetadata.InitializeChildren(ISession session, SysDictMenu dictMenu, WebMenuMetadata webMenu)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebMenuMetadata.GetWebMenuMetadata(ISession session, SysDictMenu dictMenu, Boolean subMenu)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebMenuMetadata.InitializeChildren(ISession session, SysDictMenu dictMenu, WebMenuMetadata webMenu)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebMenuMetadata.GetWebMenuMetadata(ISession session, SysDictMenu dictMenu, Boolean subMenu)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebMenuMetadata.GetWebMenuMetadata(ISession session, String webMenuName)
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Caching.ItemCache`2.<>c__DisplayClassc.<GetItemCustom>b__b()
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Caching.CacheBase.CacheRead(ICacheReadArgs cacheReadArgs, Action tryReadAction, Action readThroughAction)
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Caching.ItemCache`2.GetItemCustom(TKey key, Func`2 itemAccessor)
   at Microsoft.Dynamics.AX.Framework.Services.Client.MetadataCache.GetWebMenuMetadata(ISession session, String webMenuName)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebModuleMetadata.GetWebModuleMetadata(ISession session, SysDictMenu dictMenu, Boolean subModule)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebModuleMetadata.InitializeChildren(ISession session, SysDictMenu dictMenu, WebModuleMetadata webModule)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebModuleMetadata.GetWebModuleMetadata(ISession session, SysDictMenu dictMenu, Boolean subModule)
   at Microsoft.Dynamics.AX.Framework.Services.Client.WebModuleMetadata.GetWebModuleMetadata(ISession session, String webModulePath)
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Caching.ItemCache`2.<>c__DisplayClassc.<GetItemCustom>b__b()
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Caching.CacheBase.CacheRead(ICacheReadArgs cacheReadArgs, Action tryReadAction, Action readThroughAction)
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Caching.ItemCache`2.GetItemCustom(TKey key, Func`2 itemAccessor)
   at Microsoft.Dynamics.AX.Framework.Services.Client.MetadataCache.GetWebModuleMetadata(ISession session, String webModulePath)
   at Microsoft.Dynamics.Framework.Portal.UI.WebControls.MasterPageControl.FindRedirectPageForModule(ISession session, String& redirectMenuItemForModule)
   at Microsoft.Dynamics.Framework.Portal.UI.WebControls.MasterPageControl.RedirectToHomePageAndCompany(SPWeb site)
Thread was being aborted.
System.Threading.ThreadAbortException
   at System.Runtime.InteropServices.Marshal.CopyToManaged(IntPtr source, Object destination, Int32 startIndex, Int32 length)
   at System.Net.SafeDeleteContext.InitializeSecurityContext(SecurDll dll, SafeFreeCredentials& inCredentials, SafeDeleteContext& refContext, String targetName, ContextFlags inFlags, Endianness endianness, SecurityBuffer inSecBuffer, SecurityBuffer[] inSecBuffers, SecurityBuffer outSecBuffer, ContextFlags& outFlags)
   at System.Net.SSPIAuthType.InitializeSecurityContext(SafeFreeCredentials credential, SafeDeleteContext& context, String targetName, ContextFlags inFlags, Endianness endianness, SecurityBuffer[] inputBuffers, SecurityBuffer outputBuffer, ContextFlags& outFlags)
   at System.Net.SSPIWrapper.InitializeSecurityContext(SSPIInterface SecModule, SafeFreeCredentials credential, SafeDeleteContext& context, String targetName, ContextFlags inFlags, Endianness datarep, SecurityBuffer[] inputBuffers, SecurityBuffer outputBuffer, ContextFlags& outFlags)
   at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean throwOnError, SecurityStatus& statusCode)
   at System.Net.Security.NegoState.GetOutgoingBlob(Byte[] incomingBlob, Win32Exception& e)
   at System.Net.Security.NegoState.StartSendBlob(Byte[] message, LazyAsyncResult lazyResult)
   at System.Net.Security.NegoState.CheckCompletionBeforeNextSend(Byte[] message, LazyAsyncResult lazyResult)
   at System.Net.Security.NegoState.ProcessReceivedBlob(Byte[] message, LazyAsyncResult lazyResult)
   at System.Net.Security.NegoState.StartSendBlob(Byte[] message, LazyAsyncResult lazyResult)
   at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential credential, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
   at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeInitiator.OnInitiateUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity)
   at System.ServiceModel.Channels.StreamSecurityUpgradeInitiatorBase.InitiateUpgrade(Stream stream)
   at System.ServiceModel.Channels.ConnectionUpgradeHelper.InitiateUpgrade(StreamUpgradeInitiator upgradeInitiator, IConnection& connection, ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
   at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
   at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Dynamics.AX.Framework.Services.Metadata.Service.IAxMetadataService.GetWebMenuItemMetadata(WebMenuItemKey[] menuItemKey)
   at Microsoft.Dynamics.AX.Framework.Services.Client.ServiceClientHelper.InvokeChannelOperation[TResult,TChannel](IServiceClient`1 client, Func`2 operationInvoker, Func`2 exceptionWrapper)



Resolution
Change connection time-out properties in the web.config file
1.    In a basic text editor such as Notepad, open the web.config file for example %SYSTEMDRIVE%\Inetpub\wwwroot 
-or- 
%SYSTEMDRIVE%\\Inetpub\wwwroot\wss\VirtualDirectories\
14841
folder (Here 14841 is my port folder)
1.    Press CTRL + F to open the Find dialog box.
2.    Find the following tag:
<httpRuntime maxRequestLength="51200" />
3.    Replace it with this tag:
<httpRuntime executionTimeout="6000" maxRequestLength="51200" />
4.    Find the following tag (you might have to search from the beginning of the file):
</sectionGroup>
5.    Add the following tags on new lines after the </sectionGroup> tag:
<sectionGroup name="DynamicsAX">
<section name="Deployment" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
6.    Find the following tag:
</SharePoint>
7.    Add the following tags on new lines after the </SharePoint> tag:
<DynamicsAX>
<Deployment SiteCreationTimeOut="1200" />
</DynamicsAX>
8.    Save your changes, and close the web.config file.
9.    At the command prompt, type iisreset, and then press ENTER.





Wednesday, 25 March 2015

Get default dimension for a Main account id

Use the below code to get default dimension for any main account id


static void getDefDimMainAccId(Args _args)
{
    RefRecId    defDim;

    defDim = DimensionStorage::getDefaultAccountForMainAccountNum('10000');
 
     info(int642str(defDim ));

}


Wednesday, 18 March 2015

Default a string value in DMF AX 2012 (Instead of creating a generate methods or hardcode in design)

Last week when i was doing an import for employee entity, my analyst told that customer won't provide email description in import file and it was just a textual description which was common throughout my DMF import. First i thought to write a generate method (which is again a time consuming option), then i found an easier way to do it. DMF has build in functionality to pass a constant string/default value. To do that

Steps

1. Go to Processing groups form.
2. Select the entity for which you have pass default value and click Entites.



3. In the Entites screen select modify source mapping.

4. Follow the step in below image

5. Provide default staging value in below screen



6. Click Ok.

That will add your text value in staging.

Happy day :)


Wednesday, 11 March 2015

How RECID is generated in AX 2012 ?

In AX 2012 RECID is created by a store procedure in which is available your transaction database (not model database). The name of the store procedure is sp_GetNextRecId.



Now you can use the same SP to create RECID.  

Friday, 6 March 2015

DMF error "INVALID FUNCTION NAME" while doing Modify target mapping in AX 2012(Custom method added to base entity)

I have created a custom generate method in existing employee entity for DMF . The method what i created was generateNino(). But while modifying target mapping in Target entity form i was getting infolog with following error.


"Invalid function name: generateNino"


Solution:

Just restart the AOS services and try to run Modify target mapping.

Monday, 2 March 2015

Error When open Data Import \ Export parameters screen


When an user open Data Import \ Export  parameters screen, system raises the following error:
"Assembly containing type Microsoft.Dynamics.AX.DMF.ServiceProxy.DmfEntityProxy is not referenced"
"Object CLR object could not be created"
and this issue appeared only when database server is not the same as AOS server.

Step to Resolve
1.  Make sure Microsoft Dynamics AX Data Import/Export Framework Service and AOS server (Microsoft Dynamics AX Object Server 6XXXX-MicrosoftDynamicsAX) has the same service account.

2. Go to Local users and group and Add the same service account to Microsoft Dynamics AX Data Import Export Framework Service Users group. This group folder exist only on system where you have installed "Microsoft Dynamics AX Data Import/Export Framework Service " and not on AOS

3.  Restart the sytem which has Microsoft Dynamics AX Data Import/Export Framework Service .

4. Post any issue exist.

Wednesday, 11 February 2015

Export data from AX as HTML file

Hi All

Following code is to export data from AX as HTML file


static void HtmlCustomerWriter(Args _args)
{

    System.IO.StreamWriter sw;
    InteropPermission perm = new InteropPermission(InteropKind::ClrInterop);
    CustTable   custTable;
   
    perm.assert();

    sw = new System.IO.StreamWriter(@"C:\test.Html");
   
    //Html write
    sw.WriteLine("<Html>");

    // Header part
    sw.WriteLine("<head>");
    sw.WriteLine("<title>Cutomer list</title>");  
    sw.WriteLine("</head>");

    // body part
    sw.WriteLine("<body>");  
   
    //Data in table format form custtable
    sw.WriteLine("<table>");
    while select crossCompany CustTable
    {
      sw.WriteLine("<tr><td>");
      sw.WriteLine(custTable.AccountNum);
      sw.WriteLine("</td><td>");
      sw.WriteLine(custTable.name());
      sw.WriteLine("</td></tr>");
    }

    sw.WriteLine("</table>");
    sw.WriteLine("</body>");


    sw.WriteLine("</Html>");
    sw.Flush();
    sw.Close();
    sw.Dispose();

    CodeAccessPermission::revertAssert();

}