Transaction across multiple stored procedures



If you begin a transaction in calling stored procedure, it would be valid in the called stored procedure as well. All you have to make sure is, if the insert fails, return an error code from the called(child) stored procedure and handle it in the calling stored procedure. Or Handle the rollback in the child itself and raise an error in the catch block. Here is a skeleton:

Create procedure [dbo].[parent]
as
Begin Transaction
Begin Try
    Exec Child
End Try
Begin Catch
    If @@Trancount > 0
        RollBack
End Catch
Commit


Create procedure [dbo].[Child]
as
Begin Transaction
Begin Try
    --Do inserts here
End Try
Begin Catch
    If @@Trancount > 0
        RollBack
    RAISERROR('Error Occured',16,1)
End Catch
Commit

Am I on the right path to achieve my ambitions?

Chasing my Ambitions!!
Let me start with my what my ambition really is. My ambition is to take my nation out of the dirt in which it is in right now, help make it a powerful nation that gives equal rights of food, clothes and house to each of its citizens. In other words, I want to serve all the needy people in my Country so that they can feel empowered and never have to beg for anything. But I know that cannot done being just an employee of an company; for that I vie to become a entrepreneur who heads a very large business group like Mittals, Ambanis, Tatas etc.  I am really committed to it and most of the times I feel I am heading towards it. But sometimes due to some events in my day to day life or while just thinking of where I am right now, I get confused if I am on the right path to reach to my destination, or I need a real change to get back to right track.

The basic requirement (of course not only it) for an entrepreneur these days is money and time, rather lots of it. I thought several times to get into my own software company during my last 8 years of job days, but it stayed only in my thoughts and never came out of it, perhaps sometimes due to economical problems and sometimes due to timing problems. I am already 30 and am still earning just enough to feed and take care of the basic stuffs my family need, I don’t have any other source of earnings, still living on rent, no bank balance. And as far as time is concerned, I have a very busy and tight office schedule. Eventhough I am confident that nothing can stop me achieving my aim but still the question at this point of time is - how? When I think of my mates, they are in much better position than me, working for the biggies like Infy, Cognizant etc., earning no less than twice or thrice what I earn. Moreover, they're having very settled and stable life thus get enough time for pondering over things other than the routine work. So, is this the solution? Should I start by changing my job to some big MNC so that I can have more money and time for my aims. But I don’t think this is the perfect solution, since I have hardly seen any of my friends working for big MNCs becoming entrepreneur, leave aside the question of doing something for nation.

On top of it, I don't know why but I really hate switching my loyalties and thus the companies. In my  years of experience till date,  I have worked till date only for two companies, and tried my best to stick with them in all thick and thins. My first company was called Third Eye Software Pvt Ltd. This was the company where I learnt real dot net programming using best practices and leading project teams under the able guidance of Naveen Kohli, who has been author of many great online articles and author of dot net books under wrox publisher. I worked there too for long, but had to leave a day, when we were just 6-8 left for development and were on the brink of closing the company. Now I am working since 3 years in a mid size software company called Safaltek, where I got real good opportunities like travelling overseas manytimes, appreciated several times by my senior peers and client , rose to almost highest possible levels. Now the same company is trying to get me into US for long tenure, so that I can earn more and they can benefit with my skills.

So, the conclusion is  I should just stay on where I am, do my best in what I am doing, try to save some time for my family and wait for the right opportunities that may help me to achieve my goals earliest.

I am the problem as well as the solution, isn't it ? ;-D 

Your suggestions would really be appreciated.

Dynamic Help-System for Web based applications

 

Introduction

This is a simple and quick help system which pops up page-specific help page on the base of url. One can change the html text of the help anytime for anypage by changing the xml file kept at the website folder.

 

Background

Recently I was asked by client to develop a simple and quick help system which should be page specific and using which he can change the html text of the help anytime for anypage by changing any static file kept at the website folder

 

Using the code

Default page is the dummy place from where hyperlink can be clicked to pop up the help for default page. This can be placed at some common place like master page which will bring the page id from xml on the basis of the url on the address bar and then redirect to DynamicHelp.aspx - the page which is common page for rendering help for any page.

lnkGetHelp.OnClientClick = "javascript:window.open('DynamicHelp.aspx?" + GetPageQueryStringsFromXML() + "','DynamicHelp','width=500,height=300,toolbar=no,scrollbars=yes,resizable=no,dependent=yes');return false;";
This is the page xml I am using for mapping pageid, url and title, please note html being in CDATA I can put any html there:

"2" url="/Default.aspx" helptitle="Default help title">
 
 
Then in the Help page I am fetching the helptext on and title text on the basis of page id and rendering it on html page as follows:
 
XPathDocument doc = null;
XPathNavigator nav = null;
XPathExpression expr = null;
XPathNodeIterator iterator = null;
StringBuilder sbHtml = new StringBuilder();
//set the title bar if pagetitle value is other than 0ttlHelp.Text = (pageTitle != "0") ? pageTitle : "";
try
{
//creates an instance of XPathDocument class and loads xmlif (System.IO.File.Exists(Server.MapPath("/Components/PageHelp.xml")))
{
doc = new XPathDocument(Server.MapPath("/Components/PageHelp.xml"));
//An XPathNavigator object acts like a cursor, addressing a node in the XML document at a timenav = doc.CreateNavigator();
// Compile a standard XPath expressionexpr = nav.Compile("/Pages/Page[@id=" + pageID + "]/PageHelpText");
iterator = nav.Select(expr);
//if node is found, count would be greater than 0 if (iterator.Count > 0)
{
//Iterate through the selected nodeswhile (iterator.MoveNext())
{
//if attribute is not there but node is there,null will be returnedif (iterator.Current.InnerXml != null)
{
sbHtml.Append("Help:" + pageTitle + "

");
sbHtml.Append(HttpUtility.HtmlDecode(iterator.Current.InnerXml));
divHelpParent.InnerHtml = sbHtml.ToString();
}
}
}
else
{
Response.Write("Sorry! No help available for this page!");
}
}
}
finally
{
//when control is returned out of the method, corresponding ref variables are made nullsbHtml = null;
pageID = null;
pageTitle = null;
doc = null;
nav = null;
expr = null;
iterator = null;
}
 

Points of Interest

I liked the efficient way of bringing text from xml using XPathDocument and the dynamic nature of this tool to add any kind of help text you want int the xml itself.


You can download the sample from below article I have posted on codeproject:
http://www.codeproject.com/KB/applications/HelpSystem.aspx

CMS compared - The best CMS in today's market according to me

Since CMS'es like Drupal, Joomla, DNN are getting quite a attention these days, I thought to evaluate various open source CMS available in today's market. I am basically a C#.net professional so am biased towards asp.net CMS programmed in C#, so I started with CMS based on it.

In C#, I think mojoPortal is leading the race, with the lots of free out of box features it has. Dotnetnuke is another good asp.net CMS but is based on vb.net, which I don't like being a bit too much verbose. Kentico is also good one, but enterprise level stuff are not free there. But for all asp.net cms hosting is a big issue, most of it needs full trust level hosted space, which is difficult to get.

In this area, Joomla and Drupal are very easy to host, rather many host providers have feature to install it  for free for you, confirming their 'ease to configure' feature. And, all the stuffs are free in joomla and drupal, the only issue I have with this that its not in my native language C#, its in PHP. But available feature for these two are enticing, especially I would recommend Drupal which boasts of free time tracking, project management, dashboard, Drag n drop which even Joomla do not happen to have.

So for me Drupal is the clear winner and I am going to explore it more, so what I am not a PHP developer but I am certainly fan of open source projects.

 Here is a comparison I picked from a great cms site (would have been really difficult to type these much of things :-D ) comparer, http://www.cmsmatrix.org/matrix/cms-matrix





Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3


Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Last Updated

2/8/2010

5/28/2004

1/4/2007

8/20/2009

2/3/2010

1/11/2009

2/26/2009

1/9/2009


System Requirements

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Application Server

IIS/.Net

IIS/.Net

IIS/.Net

IIS/.Net

IIS/.Net

CGI

Apache

IIS/.Net


Approximate Cost

30EUR + VAT per domain


Free

Free

USD 1200 +

Free

Free

Free


Database

MSSQL

MSSQL

MSSQL

MSSQL

MSSQL

MySQL

MySQL

MSSQL


License

Open Source

Open Source

Open Source

Open Source

Closed Source

Open Source

Open Source

Open Source


Operating System

Windows Only

Windows Only

Windows Only

Platform Independent

Windows Only

Platform Independent

Platform Independent

Windows Only


Programming Language

C#

C#

VB

C#

C#

PHP

PHP

VB


Web Server

IIS

IIS

IIS

Apache

IIS

Apache

Apache

IIS


Security

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Audit Trail

Yes

Limited

No

No

Yes

No

Yes

Limited


Content Approval

Yes

Yes

No

Yes

Yes

Yes

Yes

Limited


Granular Privileges

Yes

Yes

Yes

Yes

Yes

No

Yes

Yes


Kerberos Authentication

No

No

No

Yes

Yes

No

No

No


LDAP Authentication

Yes

No

No

Yes

Yes

Yes

Free Add On

No


Login History

Yes

Yes

No

Yes

Yes

Yes

Yes

Yes


NIS Authentication

No

No

No

Yes

No

No

No

No


NTLM Authentication

No

No

No

Yes

Yes

No

Free Add On

Yes


Pluggable Authentication

Yes

Costs Extra

Yes

Yes

Yes

Yes

Yes

Yes


Problem Notification

Yes

Limited

Limited

Yes

Yes

No

No

Yes


Sandbox

Yes

Yes

No

Yes

No

No

No

Yes


Session Management

No

Limited

Limited

Limited

Yes

Yes

Yes

Yes


SMB Authentication

No

No

No

No

No

No

No

No


Versioning

Yes

No

Yes

Yes

Yes

Free Add On

Yes

Limited


Support

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Certification Program

Yes

Limited

No

No

Yes

No

No

Yes


Commercial Manuals

Yes

No

No

No

Yes

Yes

Yes

Yes


Commercial Support

Yes

Yes

No

Yes

Yes

Yes

Yes

Yes


Commercial Training

Yes

Yes

No

Yes

Yes

Yes

Yes

Yes


Developer Community

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes


Online Help

Yes

No

Limited

Yes

Yes

Yes

Yes

Yes


Pluggable API

Yes

No

Yes

Yes

Yes

Yes

Yes

Yes


Professional Hosting

Yes

Yes

No

Yes

Yes

Yes

Yes

Yes


Professional Services

Yes

Yes

No

Yes

Yes

Yes

Yes

Yes


Public Forum

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes


Public Mailing List

Yes

Yes

Yes

Yes

Yes

No

Yes

Yes


Third-Party Developers

Yes

Yes

No

No

Yes

Yes

Yes

Yes


Ease of Use

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Drag-N-Drop Content

Yes

No

No

Yes

Yes

No

Free Add On

Yes


Email To Discussion

No

No

No

No

No

Free Add On

Free Add On

Costs Extra


Friendly URLs

Yes

Limited

Yes

Yes

Yes

Yes

Yes

Yes


Macro Language

Yes

No

No

No

Yes

Yes

Free Add On

Yes


Server Page Language

Yes

No

Yes

Yes

Yes

Yes

Yes

Yes


Template Language

Yes

No

Yes

Yes

Yes

Yes

Limited

Yes


UI Levels

Yes

No

Yes

No

Yes

Yes

No

Yes


Undo

Yes

No

No

No

Yes

No

Limited

Limited


WYSIWYG Editor

Yes

Yes

Yes

Yes

Yes

Yes

Free Add On

Yes


Performance

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Advanced Caching

Yes

Yes

Limited

Yes

Yes

Yes

Yes

Yes


Load Balancing

Yes

No

Yes

Yes

Yes

Yes

Yes

Yes


Page Caching

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes


Management

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Advertising Management

Free Add On

Costs Extra

No

Limited

No

Yes

Free Add On

Yes


Asset Management

Yes

Yes

No

Limited

Yes

Yes

Yes

Yes


Clipboard

Yes

No

No

No

Yes

No

No

Yes


Content Scheduling

Yes

Yes

No

Yes

Yes

Yes

Free Add On

Yes


Content Staging

Costs Extra

Costs Extra

No

No

Yes

No

Free Add On

Limited


Inline Administration

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes


Online Administration

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes


Package Deployment

Yes

No

Yes

Yes

Yes

No

No

Yes


Sub-sites / Roots

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes


Themes / Skins

Yes

Yes

Limited

Yes

Yes

Yes

Yes

Yes


Trash

Yes

No

No

No

Yes

Yes

No

Yes


Web Statistics

Yes

Yes

No

Limited

Yes

Yes

Yes

Yes


Web-based Style/Template Management

Yes

Yes

Limited

No

Yes

Yes

Yes

Yes


Web-based Translation Management

Yes

Limited

No

No

Yes

Free Add On

Yes

Yes


Workflow Engine

Yes

Limited

No

No

Yes

No

Limited

Limited


Interoperability

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Content Syndication (RSS)

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes


FTP Support

No

Yes

Yes

No

Yes

Yes

Limited

Yes


WAI Compliant

Yes

Limited

Limited

Yes

Yes

No

Limited

Limited


WebDAV Support

No

No

Yes

No

No

No

No

Costs Extra


XHTML Compliant

Yes

Yes

Limited

Yes

Yes

No

Yes

Yes


Flexibility

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


CGI-mode Support

No

No

Yes

No

No

Yes

Yes

No


Content Reuse

Yes

Yes

Limited

Yes

Yes

Yes

Limited

Yes


Extensible User Profiles

Yes

Costs Extra

Limited

Yes

Yes

Yes

Yes

Yes


Interface Localization

Yes

Yes

Limited

Yes

Yes

Yes

Yes

Yes


URL Rewriting

Yes

No

Yes

Yes

Yes

Yes

Yes

Yes


Built-in Applications

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Blog

Free Add On

Yes

Limited

Yes

Yes

Yes

Yes

Yes


Chat

No

No

No

Yes

Costs Extra

Free Add On

Free Add On

Yes


Classifieds

Free Add On

No

No

No

Yes

Free Add On

Free Add On

Yes


Contact Management

No

No

Limited

No

No

Yes

Free Add On

Yes


Data Entry

Yes

Limited

No

No

Yes

Free Add On

Free Add On

Yes


Database Reports

No

Yes

No

No

Yes

Free Add On

No

Yes


Discussion / Forum

Free Add On

Yes

No

Yes

Yes

Free Add On

Yes

Yes


Document Management

No

No

No

Yes

Yes

Free Add On

Limited

Yes


Events Calendar

Free Add On

Yes

No

Yes

Yes

Free Add On

Free Add On

Yes


Expense Reports

No

No

No

No

No

Free Add On

No

Costs Extra


FAQ Management

Free Add On

Yes

No

No

Yes

Yes

Yes

Yes


File Distribution

Free Add On

Yes

No

Yes

Yes

Free Add On

Free Add On

Yes


Groupware

Free Add On

Limited

No

No

Yes

Free Add On

Free Add On

Costs Extra


Guest Book

Free Add On

No

No

No

Yes

Free Add On

Free Add On

Yes


Help Desk / Bug Reporting

No

Limited

No

No

Yes

Free Add On

Free Add On

Costs Extra


HTTP Proxy

No

No

No

No

No

No

No

Yes


Job Postings

Yes

No

No

No

Yes

Free Add On

Free Add On

Costs Extra


Link Management

Yes

Yes

Yes

Yes

Yes

Yes

Free Add On

Yes


Mail Form

Yes

Yes

No

Yes

Yes

Yes

Free Add On

Yes


My Page / Dashboard

Yes

No

No

Yes

Yes

No

Free Add On

Yes


Photo Gallery

Yes

Yes

No

Yes

Yes

Free Add On

Free Add On

Yes


Polls

Yes

Yes

No

Yes

Yes

Yes

Yes

Yes


Product Management

No

Yes

No

Yes

Yes

Yes

Free Add On

Yes


Project Tracking

No

Yes

No

No

No

Free Add On

Free Add On

Costs Extra


Search Engine

Yes

Yes

No

Yes

Yes

Yes

Yes

Yes


Surveys

Costs Extra

Yes

No

Yes

Yes

Free Add On

Free Add On

Limited


Syndicated Content (RSS)

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes


Tests / Quizzes

No

Yes

No

No

No

Free Add On

Free Add On

Free Add On


Time Tracking

No

No

No

No

No

No

Free Add On

Costs Extra


User Contributions

Free Add On

Yes

No

No

Yes

Yes

Yes

Yes


Web Services Front End

No

Yes

No

No

No

Yes

Limited

Free Add On


Commerce

Umbraco CMS 4.0

Rainbow 1.0

OmniPortal 2005.0

mojoPortal 2.3.1.3

Kentico CMS for ASP.NET 4.1 5.0

Joomla! 1.5.10

Drupal 6.10

DotNetNuke 5.0.0


Affiliate Tracking

Free Add On

No

No

No

Yes

Free Add On

Free Add On

Yes


Shopping Cart

Free Add On

Yes

No

Yes

Yes

Free Add On

Free Add On

Yes

Enjoy :-D