Posts

Chanakya's Quotes - Worth reading a million times…

Chanakya's Quotes - Worth reading a million times… *************************************************** 'A person should not be too honest. Straight trees are cut first and Honest people are victimised first.' *************************************************** 'Even if a snake is not poisonous, it should pretend to be venomous.' *************************************************** 'The biggest guru-mantra is: Never share your secrets with anybody. ! It will destroy you.' *************************************************** 'There is some self-interest behind every friendship. There is no Friendship without self-interests. This is a bitter truth.' *************************************************** 'Before you start some work, always ask yourself three questions - Why am I doing it, What the results might be and Will I be successful. Only when you think deeply and find satisfactory answers to these questions, go ahead.' ****************...

Anger & Love

ANGER & LOVE While Dad was polishing his new car, his four-year old son picked up a stone & scratched lines on the side of the car. In his anger, Dad took the child's hand & hit it many times, not realizing he was using a wrench. At the hospital, his child said, "Dad, when will my fingers grow back?" Dad was so hurt, he went back to the car and kicked it a lot of times. Sitting aside, he looked at the scratches. Child wrote, "I LOVE YOU DAD". ANGER & LOVE have no limits..... we never realize when we hurt someone..... its easy hurting..... n its easy forgiving but its very hard to forget..... specially for the one who's hurt..... Whenever you are angry remember this story...

Error Logging using ASP.NET 2.0

Error Logging using ASP.NET 2.0 This article has been republished with a few minor changes. Errors and failures may occur during development and operation of a website. ASP.NET 2.0 provides tracing, instrumentation and error handling mechanisms to detect and fix issues in an application. In this article, we will adopt a simple mechanism to log errors and exceptions in our website. We will be using a mechanism where the user will be redirected to a separate page whenever an error is encountered in the application. Simultaneously, the error will get logged in a text file on the server. The error file will be created on a daily basis, whenever the error is encountered. Having said that, let us now see some code. Step 1: Start by creating an Error folder where all errors will be logged. Right click the website > New Folder. Rename the folder to “Error”. Also add a web.config file, if one does not already exist in your site. Right click the website > Add New Item > Web.config. Step...

Using Session State with SQL Server

SQL Server Session State in ASP.NET 2.0 The Following Command is used to install Sql Server Session state for ASP.NET 2.0 c:\Program Files\Microsoft Visual Studio 8\VC>aspnet_regsql.exe -C "Data Source=PC8\SQLEXPRESS;Initial Catalog=AdventureWorks;Integrated Security=True" -ssadd -sstype c Start adding session state. .......... Finished. To use this custom session state database in your web application, please specify it in the configuration file by using the 'allowCustomSqlDatabase' and 'sqlConnectionString' attributes in the \ section. c:\Program Files\Microsoft Visual Studio 8\VC> The Following statement is needed to add in WEb.config File < system.web > < sessionstate allowcustomsqldatabase="true" timeout="20" mode="SQLServer" cookieless="false" sqlconnectionstring="Data Source=PC8\SQLEXPRESS;Initial Catalog=AdventureWorks;Integrated Security=True" > < /sessionstate > < /SYSTEM.W...

SQL Query With Parameter

To Query on Sql Server With Parameter- The Best Way string sqlCon = ConfigurationManager.ConnectionStrings["AdventureWorksConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(sqlCon); SqlCommand com = new SqlCommand("select * from Test1 where ID=@ID", con); com.Parameters.Add("@ID", SqlDbType.Int).Value = 6; SqlDataAdapter adp = new SqlDataAdapter(com); DataSet ds = new DataSet(); adp.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind();

Why the Elephants Don't Run?

Why the Elephants Don't Run? A number of years ago, I had the rather unique experience of being backstagein Madison Square Garden, in New York, during the Ringling Brothers Barnum &Bailey Circus. To say the least, it was a fascinating experience. I was ableto walk around looking at the lions, tigers, giraffes and all the othercircus animals. As I was passing the elephants, I suddenly stopped, confusedby the fact that these huge creatures were being held by only a small ropetied to their front leg. No chains, no cages. It was obvious that theelephants could, at any time, break away from their bonds but for somereason, they did not. I saw a trainer near by and asked why these beautiful,magnificent animals just stood there and made no attempt to get away."Well," he said, "when they are very young and much smaller we use the samesize rope to tie them and, at that age, it's enough to hold them. As theygrow up, they are conditioned to believe they cannot break away...

GridView Manual Sorting

/// /// The GridView_OnSorting event which is fired when the header of the column to sort is clicked. /// /// /// protected void gvItems_Sorting(object sender, GridViewSortEventArgs e) { try { DataTable dt = GetAllItems(); DataView dv = new DataView(dt); if (GridViewSortDirection == SortDirection.Ascending) { GridViewSortDirection = SortDirection.Descending; dv.Sort = e.SortExpression + " DESC"; } else { GridViewSortDirection = SortDirection.Ascending; dv.Sort = e.SortExpression + " ASC"; } gvItems.DataSource = dv; gvItems.DataBind(); } catch (Exception ex) { } } /// /// The GridV...