Sunday, April 25, 2010

DTSX failed to execute when invoked from web application ASP.Net

Hi there...

Usually i use to have a console application to execute a DTSX file(SQL Server Integration Service - Business Intelligence application) And schedule it to run for automated execution.

This time the requirement was to run another DTSX file on demand by end user. So we decided to go for a web application.

I made use of the same code which i used in previous post on submit click event here. Earlier i was getting permission related errors. The issue was solved when i gave permission for the respective user on whose credential the request is executed as anonymous user. When this issue was fixed, The other issue came was that the "Execution Failed" When the web page was executed from outside. Apparently it was working great when executed from Visual studio! Still the permission related issue was there...

After lots of Googling & trials found the solution!!!

you need to the following:
1. In IIS, Right Click the Project -> Properties
2. Click on ASP.NET tab
3. Click 'Edit Configuration' button
4. Click 'Application' Tab
5. Under Identity Settings -> Click the Checkbox 'Local Impersonation'
6. Give the user name & password for local user of the machine(who has access to run the DTSX applicaiton)

Thats it... now when you run the web application it works fine :)

Hope It Helps...


Thursday, April 8, 2010

Infopath: Code Behind Issue Event ID:5337


When I had Code-behind for business logic in Infopath forms like:

XPathNavigator nav = MainDataSource.CreateNavigator();

nav.SelectSingleNode("//my:CurrentUser", NamespaceManager).SetValue("SOME Values");

the following Warning message was shown:

Warning Message:

Object reference not set to an instance of an object.

System.NullReferenceException: Object reference not set to an instance of an object.
at ItemCreation.FormCode.FormEvents_Loading(Object sender, LoadingEventArgs e)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.FormEventsHost.<>c__DisplayClass6.<>c__DisplayClassa.b__3()
at Microsoft.Office.InfoPath.Server.Util.DocumentReliability.InvokeBusinessLogic(Thunk thunk)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.FormEventsHost.<>c__DisplayClass6.b__2(Object sender, LoadingEventArgs e)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.FormEventsHost.<>c__DisplayClass34.b__30()
at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.CallFormCodeWithExceptionHandling(UserMessages userMessages, OMCall d)

An entry has been added to the Windows event log of the server.
Log ID:5337

Seems the Error use to come when ever we try to SET VALUE.

instead of directly setting the value. you can us like


You can have a public method

public void writeToNode(XPathNavigator xpathNav, string xpath, string value)


xpathNav.SelectSingleNode(xpath, this.NamespaceManager).SetValue(value);


And use the following code to set value:

writeToNode(nav,"//my:CurrentUser","Some Values");


Hope IT Helpz

Monday, April 5, 2010

C# method to convert Julian to Gregorian date

Hello there,

I was in urgent need to convert Julian date to Georgian for a application which reads data from DB2.

The following code was useful.

public static string JulianToDateTime(int julianDate)


int RealJulian = julianDate + 1900000;

int Year = Convert.ToInt32(RealJulian.ToString().Substring(0, 4));

int DoY = Convert.ToInt32(RealJulian.ToString().Substring(4));

DateTime dtOut = new DateTime(Year, 1, 1);

return dtOut.AddDays(DoY - 1).ToShortDateString();


Hope It Helps