Friday, June 20, 2008

query for Select current week values from table in sql server 2000

SELECT * FROM test_test where c_date Between (SELECT (DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0))) AND(SELECT DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 6))

Wednesday, June 18, 2008

Select date from calender control and show in text box

// write code in Calendar SelectionChanged event
protected void cdrCalendar_SelectionChanged(object sender, EventArgs e)
{
TextBox1.Text = cdrCalendar.SelectedDate.ToString("MM/dd/yyyy");
}

Tuesday, June 10, 2008

show selected checkbox value in text box in gridview

//write code on button click
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox c = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
if (c.Checked)
{
string abc = "select * from candidate where c_id='" + GridView1.Rows[i].Cells[1].Text + "'";
SqlDataAdapter adp1 = new SqlDataAdapter(abc, con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1, "aaa");
TextBox2.Text = ds1.Tables[0].Rows[0][1].ToString();
TextBox3.Text = ds1.Tables[0].Rows[0][2].ToString();
}
}