Clearly you already have a Dział in the SelectedValue. Either use this
instance directly, or change the way you populate the combobox.

/Oskar


Den 27 mars 2012 16:57 skrev beginnerFNH <[email protected]>:
> I tried this way:
>
>  using (ISession dbSession =
> SessionProvider.Instance.SessionFactory.OpenSession())
>            {
>                using (ITransaction transaction =
> dbSession.BeginTransaction())
>                {
>                    Osoba newPerson = new Osoba
>                    {
>                        Imie = txtFirstName.Text,
>                        SumaWydatkow =
> Convert.ToInt32(numericSumaWydatkow.Value),
>                        Dział = dbSession.Load<Dział>(Convert.ToInt32
> (comboBox1.SelectedValue))
>                    };
>
>                    dbSession.Save(newPerson);
>
>                    transaction.Commit();
>                    MessageBox.Show("You have successfully added
> person");
>                }
>            }
>
> but i retrive an error:
>
> Unable to cast object of type 'hms.core.Entities.Dział' to type
> 'System.IConvertible'.
>
> --
> 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.
>

-- 
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