private void txtFYear_TextChanged(object sender, EventArgs e)
{
if (txtFYear.Text.Length > 0)
{
string str = txtFYear.Text.ToString().Trim();
SqlConnection con = new SqlConnection(conn);
con.Open();
SqlDataAdapter da1 = new SqlDataAdapter("select * from YEARMASTER Where FromYear Like '" + str + "%'", con);
DataSet ds1 = new System.Data.DataSet();
da1.Fill(ds1);
dgvYear.DataSource = ds1.Tables[0];
dgvYear.Columns["AccountYear"].Width = 200;
dgvYear.Columns["Year_Code"].Width = 125;
if (dgvYear.Rows.Count > 0)
{
dgvYear.Visible = true;
}
else
{
dgvYear.Visible = false;
}
this.dgvYear.Columns["FromYear"].Visible = false;
this.dgvYear.Columns["ToYear"].Visible = false;
}
else
{
dgvYear.Visible = false;
}
}
No comments:
Post a Comment