Sorry,

I don't referenced the fd object on my code.

fd is an instance of FederationUnit Class and this instance isn't null

the fd Object calls instances FederationUnitDAO class and calls the
PersistObject Method passing it selfs.

It's funny to see that cause I saw the same code works fine on .Net some
time ago.

I runned this code on MonoDevelop in Debug mode and I could to browse the
values of fd object and the values of Parameters Collection when the line 3
runs. I try to alternate the parameter's order but this exception always
raises when the second one Add() method is called

PS: I am calling this code with explicit transactions causes I don't knew
that it can run without this;


2010/1/5 Luigi Piccinni <luigi.picci...@computeraid.it>

>  Are you sure that “fd” object is not null in line 4?
>
>
>
>   Luigi.
>
>
>
> p.s. (Why are you beginning a transaction only to call ExcuteNonQuery on
> the command? The code works just fine even without line 8 and 10)
>
>
>   ------------------------------
>
> *Da:* João Dias de Carvalho Neto [mailto:jdias.bjsoftw...@gmail.com]
> *Inviato:* martedì 5 gennaio 2010 12.40
> *A:* For users and developers of the Firebird .NET providers
> *Oggetto:* [Firebird-net-provider] Command.Parameters property
>
>
>
> Hi,
>
> I'm using stored procedures in Firebird to do my DAO layer with Active
> Record Pattern.
>
> In this case, I have one stored procedure called SP_UNUFDAO,
>
> Using the Command Object, when I do this code to Persist my Object on FB:
>
> 1 - FbCommand cmd = new FbCommand("SP_UNUFDAO",Connection);
> 2 - cmd.CommandType = CommandType.StoredProcedure;
> 3 - cmd.Parameters.Add("P_ACTION",FbDbType.Smallint).Value =
> CrudAction.Persist.GetHashCode();
> 4 - cmd.Parameters.Add("P_ACRN",FbDbType.Char,2).Value = fd.Acronym;
> 5 - cmd.Parameters.Add("P_DESC",FbDbType.VarChar,50).Value =
> fd.Description;
> 6 - try
> 7 - {
> 8 -     cmd.Transaction = Connection.BeginTransaction();
> 9 -     cmd.ExecuteNonQuery();
> 10 -   cmd.Transaction.Commit();
> 11 - }
> 12 - catch(Exception e)
> 13 - {
> 14 -     throw new Exception(e.Message);
> 15 - }
>
> One Exception raises at line 4, something like "Object Reference not set to
> an instance of object"
>
> What's wrong on my code?
>
> I'm using Firebird 2.1, Mono, and .Net provider 2.51
>
> thanks
>
> --
> João Dias de Carvalho Neto
>
> http://www.jdiasneto.blogspot.com
> jdias.bjsoftw...@gmail.com
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4744 (20100105) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Firebird-net-provider mailing list
> Firebird-net-provider@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>
>


-- 
João Dias de Carvalho Neto

http://www.jdiasneto.blogspot.com
jdias.bjsoftw...@gmail.com
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to