public String PesquisaBancoExiste(string strDoBanco, string ServidorInstancia, string UsuarioSQLServer, string SenhaSQLServer) { try { AbrirConexaoMaster(ServidorInstancia, "MASTER", UsuarioSQLServer, SenhaSQLServer); string strSQL = " SELECT * FROM sys.databases WHERE name = '" + strDoBanco + "'"; CmdDbMaster = new SqlCommand(strSQL, ConDbMaster); DrMaster = CmdDbMaster.ExecuteReader(); if (DrMaster.Read()) { return(DrMaster["name"].ToString()); } else { return(""); } } catch (Exception ex) { throw new Exception("Erro ao Listar Banco Existe: " + ex.Message.ToString()); } finally { FecharConexaoMaster(); } }