Posts

Showing posts from 2015

Like,freetext and contains operator in sql server 2008r2

Image
How to create freetext in sqlserver 2008r2 1. Chose any one of them as per your requirement :)

String programming in C#

How to Reverse a word from the sentences: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Programing {     class Program     {         static void Main(string[] args)         {             Console.WriteLine("String");             string str=Console.ReadLine();                       string[] arySource = str.Split(' ');             string strReverse = string.Empty;             int length = Convert.ToInt32(arySource.Length);             for (int i = length - 1; i >= 0; i--)             {                 strReverse = strReverse + " "  + arySource[i];          ...

sum of number in c#

Sum of number  using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Programone {     class Program     {           static void Main(string[] args)         {             int num1, sum=0, temp;             Console.WriteLine("Enter number");             num1 = int.Parse(Console.ReadLine());             while (num1 != 0)             {                 temp = num1 % 10;                 num1 = num1 / 10;                 sum = sum + temp;             }             Console.WriteLine(sum);             ...

Swap number in C#

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Programone {     class Program     {             static void Main(string[] args)         {             int num1, num2, temp;             Console.WriteLine("Enter number");             num1 = int.Parse(Console.ReadLine());             Console.WriteLine("Enter number");             num2 = int.Parse(Console.ReadLine());             temp = num1;             num1 = num2;             num2 = temp;             Console.WriteLine(num1);             Console.WriteLine(num2);             Co...

Even and odd number in c#

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Programone {     class Program     {         static void Main(string[] args)         {             int i;             Console.WriteLine("Enter number");             i = int.Parse(Console.ReadLine());             if (i % 2 == 0)             {                 Console.WriteLine("Evennumber");                 Console.ReadLine();             }             else             {                 Console.WriteLine("oddnumber");             ...

Cricket Querry in sql

Image
create table Cricket (  Country nvarchar(20) ) select * from Cricket insert into Cricket values ('India') insert into Cricket values ('Pakistan') insert into Cricket values ('Us') insert into Cricket values ('South Africa') select (A.Country +' VS '+B.country) As Matches from Cricket A inner join Cricket B on A.Country>b.Country

Types of Action Result in MVC

ActionResult Helper Method Description ViewResult View Renders a view as a web page PartialViewResult PartialView Section of a view,that can be rendered inside another view RedirectResult Redirect Redirect to another action method RedirectToRouteResult RedirectToRoute Redirect to another action method ContentResult Content Returns a user-defined content type JsonResult Json Retuns a serialized JSON object JavaScriptResult JavaScript Returns a script that can be executed on the client FileResult File Returns a binary output to write to the response EmptyResult (None) returns a null result public ActionResult About() { return View(); } public class SampleController : Controller { // // GET: /Sample/ public ActionResult Index() { return Content( " Hello from Index action in Sample Controller" ); } public ActionResult Verify( string username = " all" ) { return Content( " Hello from Ve...

IEnumerable

An IEnumerable generic interface is returned from query expressions. A query expression that selects ints will be of type  Enumerable, IEnumerable<T> The only thing you want is to iterate over the elements in a collection. You only need read-only access to that collection. IEnumerable  interface contains an abstract member function called  GetEnumerator()  and return an interface IEnumerator  on any success call. This  IEnumerator  interface will allow us to iterate through any custom collection. any element in a collection can be retrieved through its index property. But instead of element index, the  IEnumerator  provides two abstract methods and a property to pull a particular element in a collection. And they are  Reset() ,  MoveNext()  and  Current . IEnumerable can move forward only over a collection, it can’t move backward and between the items. IEnumerable is best to query data from in-...