public int GetNumber(string name)
{
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]);
SqlCommand myCommand = new SqlCommand("SELECT COUNT(*) AS CountOfRecords FROM yourTable WHERE Name = '" + name + "'",myConnection);
myCommand.CommandType = CommandType.Text;
myConnection.Open();
int i = (int) myCommand.ExecuteScalar();
myConnection.Close();
return i;