private string InsereURLdoTemplate(string Href) { string query = ""; OleDbDataReader DR; try { query = " select top 1 NumeroDaCaptura, NumeroMaximoDaCaptura from TagsCapturados " + " order by NumeroDaCaptura desc"; DB.ExecutaQry(query); using (DR = DB.DR(query)) { DR.Read(); int NumeroDaCaptura = Int32.Parse(DR["NumeroDaCaptura"].ToString()); int NumeroMaximoDaCaptura = Int32.Parse(DR["NumeroMaximoDaCaptura"].ToString()); if (NumeroDaCaptura >= NumeroMaximoDaCaptura) { return "1"; } } query = "select * from URLdoTemplate where URLdoLinks = '" + Href + "'"; DB.ExecutaQry(query); using (DR = DB.DR(query)) { if (DR.HasRows == false) { query = " insert into URLdoTemplate (URLdoLinks) values ('" + Href + "')"; DB.ExecutaQry(query); //query = "select top 1 NumeroDaURL from URLdoTemplate order by NumeroDaURL desc"; //using (DR = DB.DR(query)) //{ // DR.Read(); // return DR["NumeroDaURL"].ToString(); //} return ""; } else { return ""; } } } catch (Exception ex) { throw new Exception("ERRO:" + ex.Message + " Classe: Automacao Método: InsereURLdoTemplate"); } }