It will be easy and better if you modify these lines
SqlDataAdapter adapt = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adapt.Fill(ds);
with this one
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
string temp=dr.GetValue(0).ToString();
dr.Close();
}
Regards..:laugh: