Exemplo n.º 1
0
        public async Task <List <CompanySymbol> > RandomCompany() //Goes to Search Form
        {
            AccessDB accessDB = new AccessDB();
            string   conStr   = ConfigurationManager.ConnectionStrings["ConStrs"].ConnectionString;


            Task <List <CompanySymbol> > t2 = Task.Factory.StartNew <List <CompanySymbol> >(() =>
            {
                List <CompanySymbol> randomCompany = new List <CompanySymbol>();

                using (SqlConnection con = new SqlConnection(conStr))
                {
                    con.Open();
                    randomCompany = accessDB.CompaniesList(con);
                }
                return(randomCompany);
            });
            await t2;

            return(t2.Result);
        }