Hi Folks

The last message I sent was resolved. At this moment, I've got the error
above. This error happens when the code, which follows below, runs. Someone
could help me?

public Conta GetByNumConta(string num)
        {
            Conta contaEncontrada = null;
            string pattern = "^[0-9]{4}([.]{0,1}[0-9]{4})*$";
            if (!System.Text.RegularExpressions.Regex.IsMatch(num, pattern))
                throw new ArgumentException();
            string[] codigosContas = num.Split('.');
            int? id = null;
            foreach(string conta in codigosContas)
            {
                string query;
                if (id == null)
                    query = "from Conta cta where cta.NumConta = '" + conta
+ "' and cta.ContaPai = null";
                else
                    query = "from Conta cta where cta.NumConta = '" + conta
+ "' and cta.ContaPai = " + id.ToString();
                contaEncontrada =
session.CreateQuery(query).UniqueResult<Conta>();
                if (contaEncontrada != null)
                    id = contaEncontrada.Id;
                else
                    id = null;
            }
            return contaEncontrada;
        }

-- 
Best Regards
Everton Lucas

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to