public DataTable getNam() { DataTable dt = new DataTable(); cmd.CommandText = "SELECT year(ngayban) as ngayban from HOADONBAN group by year(ngayban)"; //cmd = new SqlCommand(cmd.CommandText, con.Connection); //SqlDataAdapter da = new SqlDataAdapter(cmd); //da.Fill(dt); //da.Dispose(); cmd.CommandType = CommandType.Text; cmd.Connection = con.Connection; try { con.OpenConn(); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(dt); con.CloseConn(); } catch (Exception ex) { string mex = ex.Message; cmd.Dispose(); con.CloseConn(); } return(dt); }