Friday, June 11, 2010

Find all Database in sql server 2005

select * from sys.databases


select * from sys.tables



To see all the column of table



select * from sys.all_columns where [object_id]= OBJECT_ID (N'dbo.emp')//Emp is table name
 

Wednesday, June 9, 2010

Change Text/Image Periodically in Windo application in C#

I have taken a Window Form and add a Label


and a Timer I want Label text should be

change after 5 second





public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

Timer tm = new Timer();

tm.Tick += new EventHandler(tm_Tick);

tm.Interval = (1000) * (3);

tm.Enabled = true;

tm.Start();

}

int i = 0;

void tm_Tick(object sender, EventArgs e)

{

i++;

Timer tm = (Timer)sender;

if (i == 1)

label1.Text = "NSE";

else if (i == 2)

label1.Text = "BSE";

else if (i == 3)

{

label1.Text = "NCDX";



}

else if (i == 4)

{

label1.Text = "MCX";

i = 0;

}

}

}

Tuesday, June 1, 2010

Auto Complete Option in ComboBox in C#

ArrayList ObjArrayList=new ArrayList():


private void Form_Load(object sender, EventArgs e)
{
ObjArrayList.Add("a");

ObjArrayList.Add("aa");

ObjArrayList.Add("b");

ObjArrayList.Add("bb");

ObjArrayList.Add("c");

ObjArrayList.Add("cc");

ObjArrayList.Add("d");

ObjArrayList.Add("dd");

OR

cmbSymbol.DataSource = ObjArrayList;// You can Give DataSource Also

ComboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;

ComboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

AutoCompleteStringCollection dataSymbols = new AutoCompleteStringCollection();



for (int i = 0; i < ObjArrayList.Count; i++)//If You are using DataSet then user Ds.Tables[0].Rows.Count

{

dataSymbols.Add(ObjArrayList[i].ToString());

}

ComboBox1.AutoCompleteCustomSource = dataSymbols;

}

Followers

Visitor No

click for free hit counter
Download a free hit counter here.