Thursday 15 December 2016

How to achieve method overloading in MVC? Or is it possible to achieve Method overloading in asp.net mvc?


Method overloading is possible in asp.net MVC.

This is general question which is asked in an interview.
Overloading or in other word we can say Polymorphism, it is the part of c# language. Http does not aware of this thing. Http works on URL concept and URL should be unique.

We can achieve overloading by the use of acceptverb attribute like HttpGet or HttpPost etc.
We can also use ActionMethod attribute above the method name in controller.

Example:-

public class HomeController : Controller
    {

        public ActionResult MethodName()
        {
            return Content("Method overloading with no parameter.");
        }

        [ActionName("TestMethod")]
        public ActionResult MethodName(string name)
        {
            return Content("Method overloading with with  parameter:" + name);
        }
    }

Note:-
If you didn’t put attribute ActionName above Method name then it will error at run time.

Sunday 11 December 2016

What is ISNUMERIC in SQL Server 2008R2?



Definition:-

ISNUMERIC () is a function to determines where an expression is valid numeric type or not.
ISNUMERIC return 1 when input expression is valid numeric data type, otherwise it return 0.

Syntax:-

ISNUMERIC (expression)

ReturnType:-

Int

Note:-
ISNUMERIC returns 1 for some characters that are not numbers, such as plus (+), minus (-), and valid currency symbols such as the dollar sign ($).


Example:-



Select ISNUMERIC('123')

Select ISNUMERIC(123)

Output:

1

References taken from MSDN.