Posts

Showing posts from 2012

Differences between a Structure and Class

1. Clas s is Reference types and Structure is Value type.   2. Clas s supports an Inheritance where as Structure not.   3. Classes are usually used for large amounts of data, whereas Structure are usually used for smaller amount of data.   4. When we instantiate a class, memory will be allocated on the heap and when Structure gets initiated it gets memory on the stack. 5. Classes can have explicit parameter less constructors. But Structure doesn't have this. 6. Classes can be garbage collector because garbage collector works on heap memory . structures can not be garbage collector so no memory management.

Select nth Row from Table in SQL Server

DECLARE @RowNumber INT = 9 WITH TableWithRow AS (       SELECT        ( ROW_NUMBER () OVER ( ORDER BY employees . EmployeeID )) as ROW ,        FirstName , LastName                 FROM employees ) SELECT * FROM TableWithRow WHERE ROW = @RowNumber Output: ROW                  FirstName  LastName -------------------- ---------- -------------------- 9                    Ashvin     Padhiyar (1 row(s) affected)  Note: ROW_NUMBER () is an analytic function. It assigns a unique number to each row to which it is applied, in the ordered sequence of rows specified in the order_by_clause , beginning with 1.  

Polymorphism in C#

Polymorphism means having more than one form.   Overloading and overriding are used to implement polymorphism.  Polymorphism Examples Method Overloading Method Overriding There are two type of Polymorphism  1. Compile time polymorphism (Early binding or static binding)  Examples: overloaded methods, overloaded operators and overridden methods that are called directly by using derived objects. 2. Run time polymorphism (Late binding or dynamic binding)   Example: overridden methods that are called using base class object.  

Managed Code and UnManaged Code

Managed Code is produced by (vb.net,c#,j#) .net framework language, which is under the control of CLR (Common Language Runtime).Garbage collector run automatically in managed code. Unmanaged Code is produced by third party language such as C++ can be used to write such applications, which does not run under the control of CLR.Garbage collector will not run in case of unmanaged code. Examples of Unmanaged code are Access low-level functions of the operating system. Background compatibility with code of VB, ASP and COM.

How to Update Dependent Excel Cells Automatically

Image
I was facing some issue to update excel cell which was depended on some formula, I need to change 'Comparison_Rate_Calculator' by Programming and need to read Calculated value by formula '=+HLOOKUP(C3,Workings!$D$1:$AJ$2,2,FALSE)' over 'Comparison_Rate_Calculator_Values' column. I didn't get calculated value even i was able to change 'Comparison_Rate_Calculator' column's value. So I got solutions by refreshing Excel WorkSheet and Here is the Solutions. File: Web.Config < connectionstrings >   < add       name = " xls "       connectionstring = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\AshvinWorkspace\POCs\ReadExcelSheet\ReadExcelSheet\Files\HLComparisonRateCalculator.xls;Extended Properties=Excel 8.0 " >   </ add > </ connectionstrings > File: Default.aspx.cs public partial class _Default : System.Web.UI. Page {     protected void Page_Load( ob