What am I doing wrong?

Posts   
 
    
G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 03-Jul-2005 02:48:01   

Hi,

maybe this is quite simple, but I don't know what I am doing wrong.

I have a table Machine, which has a column Company. I have mapped this column on a m:1 relation to the table Company to get a field named Company_ in my MachineEntity. After that I have mapped on this related field and now my Machine has a field named Country.

I generated self servicing project, just added a windows form, instanciated a machineentity on the form.load using the PK and filled a textbox with the Machine.Country value.

So far so good.

Now I fill a new value inside the textbox, click a button and in that event I set m.Country to this new value and then do a m.Save() But this new value is never saved, why not? Not even SQL code has been executed, checked with profiler on my SQL 2000 database.

I also made sure that I haven't selected the readonly checkboxes in the designer.

Can anybody tell me what I am doing wrong?

Gr.,

G.I.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 03-Jul-2005 10:17:11   

Make sure you set a new entity as the related entity before doing anything else. So set Machine.Company_ to a new instance of Company, then do your normal actions in the form.

Frans Bouma | Lead developer LLBLGen Pro