I have two rows with the same Eno...i want to view both the enos in ma gridview
Following is ma code:
try{
conn = new SqlConnection(@"Data Source=RAMESH\SQLEXPRESS;Initial Catalog=Payroll;Integrated Security=True");
conn.Open();
query = "Select count(Eno) from EmpLeave group by Eno having count(Eno)>1";
cmd = new SqlCommand(query, conn);
dr = cmd.ExecuteReader();
if (dr.Read())
{
conn.Close();
DataSet ds = new DataSet();
conn.Open();
strsql = "Select count(Eno) from EmpLeave group by Eno having count(Eno)>1";
SqlDataAdapter ad = new SqlDataAdapter(strsql, conn);
ad.Fill(ds);
conn.Close();
dataGridView1.DataSource = ds.Tables[0];
//dataGridView1.DataBindingComplete();
//GridView1.DataSource = ds.Tables[0];
//GridView1.DataBind();
}
else
{
MessageBox.Show("No more entries");
}
dr.Close();
conn.Close();
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}