string sql = "SELECT COUNT(*) FROM member WHERE member_no = 35000"; object resObj = dba.GetScalarFromDB(sql); string res = dba.GetScalarFromDB(sql).ToString(); int count = 0; if (int.TryParse(res, out count)) Console.WriteLine("Count = " + count.ToString()); else Console.WriteLine("Error ocurred while converting");