public static int getMax(IDbPersist oConn, string coluna, string tabela, string where) { string sql = " select max(" + coluna + ") from " + tabela + where; object cod = oConn.executeScalar(sql); if (cod != null && cod.ToString() != String.Empty) { return(Convert.ToInt32(cod.ToString())); } return(0); }
/// <summary> /// Executing a scalar function /// </summary> /// <param name="oConn"></param> /// <param name="sql"></param> /// <returns></returns> public static object executeScalar(IDbPersist oConn, string sql) { return(oConn.executeScalar(sql)); }