Your problem area in your code
adpt.Fill(dt);
Change it to
adpt.Fill(dtset); //Fill Dataset dt = dtset.Tables[0]; //Then assign table to dt
OR
You can directly use the SqlDataAdapter to populate the DataTable, so there is no need for a DataSet.
Just uninstall DataSet, use
SqlDataAdapter adpt = new SqlDataAdapter(cmd); adpt.Fill(dt); DataRow dr = dt.Rows[0];
source share