Friday, 5 September 2014

This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false

This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with 
overrideMode="Deny" or the legacy allowOverride="false




1. Click "Start button"
2. search box, enter "Turn windows features on or off"
3. features window, Click: "Internet Information Services"
4. "World Wide Web Services"
5. "Application Development Features"
6. Check (enable) the features. I checked all but CGI.

Tuesday, 29 July 2014

Bubble Sort Using C#

Something we are calling it as sinking sort, it is simple way of sorting of repedatly steps of list to make it sort. Pass the value of list to one by one until it not swap. The way the comparison sort is similar way as bubble sort.

Bubble sort example image (from Wiki)

Find the duplicates value in Array in C#

Finding the duplicate value in array using C# code.

class Program
    {
        static void Main(string[] args)
        {
            string InuputString = "Input Array \n";
             Console.WriteLine(InuputString);

             ArrayList obj = new ArrayList(){"1","4","Test","^","1","67","43","4","Ret","78"};

             for (int i = 0; i < obj.Count; i++)
             {
                 Console.Write(obj[i] + " ");
             }

             GetDuplicateArryValue(obj);
        }

        public static void GetDuplicateArryValue(ArrayList arr)
        {
            //to store all the duplicate values in Array list
            ArrayList dup = new ArrayList();

            for (int i = 0; i < arr.Count; i++)
            {
                for (int j = i + 1; j < arr.Count; j++)
                {
                    if (arr[i].Equals(arr[j]))
                    {
                        //When duplicate value is found, check
                        //whether the value not contained in the dup array list
                        if (!dup.Contains(arr[i]))
                        {
                            dup.Add(arr[i]);
                        }
                    }
                }
            }
            Console.WriteLine("\n Duplicates Number Are");

            for (int i = 0; i < dup.Count; i++)
            {
                Console.Write(dup[i] + " ");
            }
            Console.WriteLine();
        }
    }


OUTPUT :

Fibonacci Series in C#

Generating the febonacci series in C#

class Program
    {
        static void Main(string[] args)
        {
            string InuputString = "Febonacci Series \n";
             Console.WriteLine(InuputString);
             GenerateFibonacciSeries(10);
        }

        public static  void GenerateFibonacciSeries(int value)
        {
          
            int ftemp = 0;
           
            int f1 = 1;
            //temporary variable
            int f2 = 0;
            Console.Write(f1);
            //loop through all the numbers
            for (int i = 0; i < value; i++)
            {
                //assign temporary variable
                f2 = ftemp;
                ftemp = f1;
                f1 = f2 + ftemp;

                Console.Write(" ");
                Console.Write(f1);
            }

        }
    }


Output :

C# Palindrome Code

Sample code for Palindrome  in C#.


    class Program
    {
        static int strLen = 0;
        static int numLen = 0;
        static void Main(string[] args)
        {
            string InuputString = "Testset";
             Console.WriteLine(InuputString);
             ISPalindrome(InuputString);
        }

        public  static void ISPalindrome(string str)
        {

            strLen = str.Length;
            str = str.ToLower();

            while (numLen < strLen)
            {

                if (str[numLen] != str[strLen - 1])
                {
                    Console.WriteLine("Not a Palindrome");
                    break;
                }

                else
                {
                    numLen++;
                    strLen--;

                    if (numLen > strLen - 1)
                    {
                        Console.WriteLine("Palindrome");
                    }

                }

            }
        }
    }




Difference between x.equal(y) and x==y

The equal and == operator are used to compersion check and both are returning the Boolean value(true or false)

For value type both of them are working same.
e.g.
 int a= 10;
int b= 10;
if(a==b) // true;
if(a.equal(b)) // true


But for reference type both of them are behaving different.

e.g
StringBuilder sb1 = new StringBuilder(“Value”);
StringBuilder sb2 = new StringBuilder(“Value”);
If(sb1 == sb2) // false
If(sb1.equal(sb2)) // true


Thursday, 3 July 2014

Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0


Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

It is problem due to application is not pointing to proper DDL of oracle access and your GAC is having different version of Oracle.DataAccess.

To correct this you just need to put the below code into web.config file.

<runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
         <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342"/>
         <bindingRedirect oldVersion="4.121.1.0" newVersion="4.112.1.2"/>
      </dependentAssembly>
   </assemblyBinding> 
  </runtime>

By doing this when application is looking to the version which is not exist then it will redirect to the exist DLL version.

Generally by doing this you can work with the two same DDL with dirffrent version and based on the requirement you can call the version of DLL

Monday, 28 April 2014

Exporting the gridview data to excel sheet;


Create a grid view and bind the data to grid view now suppose your grid view is looking like below image;



Code for grid view

Sunday, 13 April 2014

selected row in datagridview c#

Getting the seltected rwo in the data grid from code behind in C#.

Suppose you give the name of data grid as dg;


Just do compy and paste of the below code you will get the row selected;


   public class EmplyeeBAO
    {
        private ArrayList GetSelectedRows(DataGrid dg)
{
   ArrayList al = new ArrayList();
   CurrencyManager cm = (CurrencyManager)this.
                                    BindingContext[dg.DataSource, dg.DataMember];
   DataView dv = (DataView)cm.List;
   for(int i = 0; i < dv.Count; ++i)
   {
     if(dg.IsSelected(i)) // find out the selected rwo
       al.Add(i);
   }
   return al;
}


Saturday, 12 April 2014

SQL Interview Questions and Answer

Clustered and Non-Clustered Index
What is an Index?
Index is a database object, which can be created on one or more columns (16 Max column combination). When creating the index will read the column(s) and forms a relevant data structure to minimize the number of data comparisons. The index will improve the performance of data retrieval.
Primary Key Constraint
A table column with this constraint is called as the key column for the table. This constraint helps the table to make sure that the value is not repeated and also no null entries. A table can have only one Primary key. Multiple columns can participate on the primary key column. Then, the uniqueness is considered among all the participant columns by combining their values.