Wednesday, July 20, 2011

Can you use JOIN in UPDATE ?

YES.

e.g.
update
set
from
where

Remember the syntax :
UPDATE TableA
SET colname=TableB.colname ( or anything else)
FROM TableA, TableB
WHERE  <join condition>


Have a look at following links for more information :
SUMMARTIMELISTSENSUMMER2011.id >= #tempRSC.id and SUMMARTIMELISTSENSUMMER2011.id <= #tempRSC.laststoprowid
SUMMARTIMELISTSENSUMMER2011 ,#tempRSC
routename = #tempRSC.f33
SUMMARTIMELISTSENSUMMER2011

Friday, July 15, 2011

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public
{

{

Label1.Text = abcd1.ret().ToString();



Label1.Text +=
}
}
partial class _Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e)abcd abcd1 = new abcd(30);ZZZZ z = new ZZZZ();aa a = new ZZZZ();bb b = new ZZZZ();" " + z.meth() + " " + a.meth().ToString() + " " + b.meth();class ZZZZ : aa, bb{

{

}
public int meth()return 55;#region

{

}
aa Membersint aa.meth()return 66;#endregion
#region

{

}
bb Membersint bb.meth()return 77;#endregion}interface aa{

}
int meth();interface bb{

}
int meth();struct abcd{


{
x =
}
public aaaaaa x;public abcd(int z)new aaaaaa();public class aaaaaa{


{
a = 10;
}
}

{

}
}
public int a;public aaaaaa()public int ret()return x.a;

OOP fundamentals : Explicite Interface Implementation and Structures can contain class

%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%20using%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20System%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eusing%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20System.Collections.Generic%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eusing%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20System.Linq%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eusing%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20System.Web%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eusing%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20System.Web.UI%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eusing%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20System.Web.UI.WebControls%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Epublic%0D%0A%7B%0D%0A%0D%0A%7B%0D%0A%0D%0ALabel1.Text%20%3D%20abcd1.ret().ToString()%3B%0D%0A%0D%0A%0D%0A%0D%0ALabel1.Text%20%2B%3D%20%0D%0A%7D%0D%0A%7D%0D%0A%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Epartial%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eclass%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E_Default%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3A%20System.Web.UI.%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3EPage%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eprotected%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Evoid%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20Page_Load(%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eobject%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20sender%2C%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3EEventArgs%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20e)%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eabcd%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20abcd1%20%3D%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Enew%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eabcd%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E(30)%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3EZZZZ%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20z%20%3D%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Enew%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3EZZZZ%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E()%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eaa%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20a%20%3D%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Enew%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3EZZZZ%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E()%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Ebb%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20b%20%3D%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Enew%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3EZZZZ%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E()%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%23a31515%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%23a31515%3B%20font-size%3A%20x-small%3B%22%3E%22%20%22%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%2B%20z.meth()%20%2B%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%23a31515%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%23a31515%3B%20font-size%3A%20x-small%3B%22%3E%22%20%22%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%2B%20a.meth().ToString()%20%2B%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%23a31515%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%23a31515%3B%20font-size%3A%20x-small%3B%22%3E%22%20%22%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%2B%20b.meth()%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eclass%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3EZZZZ%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3A%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eaa%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%2C%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Ebb%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%7B%0D%0A%0D%0A%7B%0D%0A%0D%0A%7D%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Epublic%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eint%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20meth()%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Ereturn%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%2055%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%23region%0D%0A%0D%0A%7B%0D%0A%0D%0A%7D%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20aa%20Members%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eint%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eaa%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E.meth()%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Ereturn%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%2066%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%23endregion%0D%0A%23region%0D%0A%0D%0A%7B%0D%0A%0D%0A%7D%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20bb%20Members%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eint%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3Aize%3A%20x-small%3B%22%3Ebb%3C%2Fspan%3E^ 2/?+{tyle%3D%22font-size%3A%20x-small%3B%22%3'8- W"aH7[pspan%20style%3D%22color%3A%20blue%3B%20fp
po_F= ~n c %22%3E%3Cspan%20style%3D%22color%3A%20bl,@ mr1[k Dq|N-small%3B%22%3Ereturn%3C%2Fspan%3E%3C%2F@J K + ) E D%22font-size%3A%20x-small%3B%22%3E%2077"< $# /$ ,5:node%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%23endregion%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%7D%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Einterface%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eaa%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%7B%0D%0A%0D%0A%7D%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eint%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20meth()%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Einterface%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Ebb%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%7B%0D%0A%0D%0A%7D%0D%0A%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eint%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20meth()%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Estruct%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eabcd%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%7B%0D%0A%0D%0A%0D%0A%7B%0D%0Ax%20%3D%20%0D%0A%7D%0D%0A%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Epublic%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eaaaaaa%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20x%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Epublic%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20abcd(%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eint%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20z)%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Enew%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eaaaaaa%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E()%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Epublic%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eclass%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20%232b91af%3B%20font-size%3A%20x-small%3B%22%3Eaaaaaa%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%7B%0D%0A%0D%0A%0D%0A%7B%0D%0Aa%20%3D%2010%3B%0D%0A%7D%0D%0A%7D%0D%0A%0D%0A%7B%0D%0A%0D%0A%7D%0D%0A%7D%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Epublic%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eint%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20a%3B%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Epublic%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20aaaaaa()%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Epublic%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Eint%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20ret()%3C%2Fspan%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3E%3Cspan%20style%3D%22color%3A%20blue%3B%20font-size%3A%20x-small%3B%22%3Ereturn%3C%2Fspan%3E%3C%2Fspan%3E%3Cspan%20style%3D%22font-size%3A%20x-small%3B%22%3E%20x.a%3B%3C%2Fspan%3E

OOP fundamentals : Explicite Interface Implementation and Structures can contain class

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public
{

{

Label1.Text = abcd1.ret().ToString();



Label1.Text +=
}
}
partial class _Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e)abcd abcd1 = new abcd(30);ZZZZ z = new ZZZZ();aa a = new ZZZZ();bb b = new ZZZZ();" " + z.meth() + " " + a.meth().ToString() + " " + b.meth();class ZZZZ : aa, bb{

{

}
public int meth()return 55;#region

{

}
aa Membersint aa.meth()return 66;#endregion
#region

{

}
bb Membersint bb.meth()return 77;#endregion}interface aa{

}
int meth();interface bb{

}
int meth();struct abcd{


{
x =
}
public aaaaaa x;public abcd(int z)new aaaaaa();public class aaaaaa{


{
a = 10;
}
}

{

}
}
public int a;public aaaaaa()public int ret()return x.a;

Tuesday, July 12, 2011

Monday, July 11, 2011

SQL Server Date Time : What will be the output of cast(0 as datetime) ?

SQL DATE TIME
1. What will be the output of following ?
select CAST (0 as datetime)
'1900-01-01 00:00:00.000'
returns epoch
2. How to create a date from given integers for year , month,date
Declare @DayOfMonth TinyInt
Set @DayOfMonth = 20
Declare @Month TinyInt
Set @Month = 6
Declare @Year Integer
Set @Year = 2006
Select DateAdd(day, @DayOfMonth - 1,DateAdd(month, @Month - 1,DateAdd(Year, @Year-1900, 0)))
3. How to get first date of current month ?
select convert(datetime ,
cast(DATEPART(year , getdate()) as nvarchar(10)) + '-' +
cast (DATEPART(month , getdate()) as nvarchar(5)) +
'-01'
)

Friday, July 8, 2011

static

1. Which operators cannot be overloaded  ?
 =, ., ?:, ->, new, is, sizeof, typeof
2. Comparsion operator
 ==, !=, <, >, <=, >=
They must be overloaded in pairs.
3.  How do you overload operators ?
By defining static member functions using the operator keyword.
4. Can non-static classes contain static members ?
 YES.
5. Can static classes contain non-static members ?
 NO.
6. Can you access static members of non-static classes using instances of non-static members ?
 NO. Static members must be accessed using thier class names, not using instances
7. What all can be static ?
method, field, property, or event
constructors can be static.
const behave like static fields , but static keyword cannot be used with them
operator overloading functions are always a static
Indexers cannot be static, the allowed access specifiers for indexers are only 

Wednesday, July 6, 2011

It is mutually exclusive to mark a method with the new and override keywords.

Classes , Structs and Interfaces

Classes
What can be the members of class, struct and interfaces?
Class: (http://msdn.microsoft.com/en-us/library/0b0thckt.aspx)
·         Constructors
·         Destructors
·         Constants
·         Fields
·         Methods
·         Properties
·         Indexers
·         Operators
·         Events
·         Delegates
·         Classes
·         Interfaces
·         Structs

Struct: (http://msdn.microsoft.com/en-us/library/ah19swz4.aspx)

Interfaces :  methods, properties, events, indexers  (http://msdn.microsoft.com/en-us/library/ms173156.aspx)


Class
Struct
Interface
Constructors
Y
Y
N
Destructors
Y
N
N
Constants
Y
Y
N
Fields
Y
Y
N
Methods
Y
Y
Y
Properties
Y
Y
Y
Indexers
Y
Y
Y
Operators
Y
Y
N
Events
Y
Y
Y
Can a static class contain non-static members?
NO. (http://msdn.microsoft.com/en-us/library/79b3xss3(v=vs.80).aspx).
The main features of a static class are:
·         They only contain static members.
·         They cannot be instantiated.
·         They are sealed.
·         They cannot contain Instance Constructors.
Constructors:
- Constructors cannot be “virtual”.
- They cannot be inherited.
- Constructors are called in the order of inheritance.
- Constructors can be overloaded.
- special function that is called when class is instantiated.
- same name as the class.
- does not have a return type.
- used to initialize values.
- can have parameters.
- compiler will supply one if not declared.
Can you define constructors for struct?
We cannot define default constructor for structs, because one is compulsorily provided by compiler.
However, we can define constructors for structs that take parameters.

Remember that the default constructor is called when we use new with struct. However, objects based on structs can be initialized or assigned and then used.
e.g. int I = new int();  //valid ; can be used
int i ; I = 33; //valid ; can be used
int I; // cannot be directly used without assigning a value, because new is not given, hence value is not initialized.
Can you define a default constructor for a strut ?
NO. It is compulsorily provided by compiler.
In how many type value types can be created? 
By calling new : int I = new int();
By assigning a value: int I = 44; //using new is not a requirement.
A base class has no default constructor but has some parametered constructors. Will the derived class have to do something?
If a base class does not offer a default constructor, the derived class must make an explicit call to a base constructor by using base. (MSDN http://msdn.microsoft.com/en-us/library/ms173115.aspx#Y1200)
Can constructors be inherited? NO.
What is the order of calling constructors and destructors in an inheritance chain ?
Constructors : Least derived (base) to Most Derived.
Destructors : Most Derived to Least Derived. (http://msdn.microsoft.com/en-us/library/66x5fx1b(v=vs.80).aspx)
Consider the following :
Class A {
               Public A() {}
              ~A(){}
}
Class B  : A {
               Public B() {}
              ~B(){}
}


What will be the order of ctor/dtor in following cases ?
B b = new A(); //INVALID
A a = new B();  // ctor A, ctor B , dtor B , dtor A
In a nested class, can you access members of container class ?
NOT DIRECTLY, you have to pass an instance of container to nested class either in nested class’s ctor or some other method.
Destructors :
·         Destructors cannot be defined in structs. They are only used with classes.
·         A class can only have one destructor.
·         Destructors cannot be inherited or overloaded.
·         Destructors cannot be called. They are invoked automatically.
·         A destructor does not take modifiers or have parameters.
What are the differences between classes and structs ?
Class
Struct
Classes are reference type
Struct is a  value type
Classes can inherit from another class  or interface but not from a class (struct cannot be a base of a class)
Structs cannot inherit from other structs or classes
A struct cannot inherit from another struct or class, and it cannot be the base of a class
http://msdn.microsoft.com/en-us/library/aa288471(v=vs.71).aspx
Classes can have destructors
Structs cannot have destructors.
Encapsulation
What is the default access level of members in a class?
Private. This is applicable to constructor also, if a constructor is provided and no access specifiers are provided for it.
However, if you do not provide a default constructor to a class, the default parameterless constructor provided by the compiler is public.
Can you inherit from a class which has only  private constructors ?
No. It is not possible to inherit a class that has only a private constructor.
Can you inherit from a static class ?
NO. Static classes are sealed and cannot be inherited. http://msdn.microsoft.com/en-us/library/79b3xss3(v=vs.80).aspx
Can a static class contain not static methods?
Inheritance
What is class inheritance and interface inheritance?

Can you inherit from a class which has only  private constructors ?
No. It is not possible to inherit a class that has only a private constructor.
What is the difference in virtual and abstract methods?
When talking about the base class, a virtual method may or may not contain implementation. But, an abstract method cannot contain implementation.
When talking about the (non-abstract) derived class, a virtual method may or may not be overridden, but an abstract method must be overridden ( or actually implemented).



Polymorphism
How many types of overloading are supported?
Method overloads and operator overloading.
What is operator overloading?