Wednesday, September 28, 2005

Difference between ReadOnly and Constant in C#



If you are using constant value you have intitalize that timeitself,but readonly filed u can initialize that timeitself or else in constructor.

Constant value is assigned in Compile time
readonly value is assigned in Run time


using System;

namespace difference
{

class read
{
public readonly int d = DateTime.Now.Hour;
public const int c = 10;

public read(int x)
{
d = x;

}
public read(int x,int y)
{
d = 12;
}



}
class Class1
{

static void Main(string[] args)
{
read obj = new read(DateTime.Now.Hour);
Console.WriteLine(obj.d);
Console.ReadLine();
}
}
}

Friday, September 23, 2005

Cursor in SQL SERVER



DECLARE country CURSOR FOR SELECT PKID,CountryName FROM countryMaster

OPEN country

FETCH NEXT FROM country
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM country
END

CLOSE country

DEALLOCATE country

Thursday, September 15, 2005

HTC ( HTML Component )




If u wanna use the HTC,u have to give the style to corresponding controls.

Here I have attached the onblur to textbox.


This is ur HTML or ASPX Page
-----------------------------------

<INPUT TYPE="text" NAME="" style="behavior:url(sankar.htc)"/>



sankar.htc
-----------------------

<PUBLIC:ATTACH EVENT="onblur" ONEVENT="hi()">

<script language="javascript">
function hi()
{
alert(this.value);
}
</script>