public bool execute() { if (SqlAuthentication) strTemplateSqlAut = string.Format(strTemplateSqlAut, _strServerName, _strUser, _strPWD,_strDataBase); else strTemplateSqlAut = string.Format(strTemplateWindowsAut, _strServerName); _objDataAccess = new clDataAccess(strTemplateSqlAut); bool bRet = false; try { bRet = _objDataAccess.executaQuery(_strQuery, clDataAccess.TipoBanco.SQLServer); } catch (Exception ex) { bRet = false; throw ex; } finally { _objDataAccess = null; } return bRet; }
public bool connection(ConnectionType connectionType) { bool bRet = false; try { switch (connectionType) { case ConnectionType.WindowsAuthentication: _objDataAccess = new clDataAccess(string.Format(strTemplateWindowsAut, _strServerName)); bRet = _objDataAccess.verificaConnexao(clDataAccess.TipoBanco.SQLServer); break; case ConnectionType.SQLAuthentication: _objDataAccess = new clDataAccess(string.Format(strTemplateSqlAut, _strServerName, _strUser, _strPWD)); bRet = _objDataAccess.verificaConnexao(clDataAccess.TipoBanco.SQLServer); break; default: break; } } catch (Exception ex) { bRet = false; throw ex; } return bRet; }
public DataTable loadData() { DataTable dtRet = null; string strConn = string.Empty; if (bSqlAuthentication) strConn = string.Format(strTemplateSqlAut, _strServerName, _strUser, _strPWD); else strConn = string.Format(strTemplateWindowsAut, _strServerName); _objDataAccess = new clDataAccess(strConn); try { dtRet = _objDataAccess.executaQueryPesquisa(_strQuery, clDataAccess.TipoBanco.SQLServer); } catch (Exception ex) { dtRet = null; throw ex; } return dtRet; }