Page 1 of 2

Item.Value not updating database value

PostPosted: 19 May 2016 04:36
by zsleo
I have a DB field that is data type integer.

I have 3 items. Item.Value(s) are 12, 99 & -1.

The value saved to the DB is the Item.ItemIndex ( not Item.Value)

If the DB field datatype is char then then DB field are saved correctly.

... how do I resolve this.

TIA

Re: Item.Value not updating database value

PostPosted: 19 May 2016 09:17
by Alexander Bulei
Hi,

The value saved to the DB is the Item.ItemIndex ( not Item.Value)


I have 3 items. Item.Value(s) are 12, 99 & -1.


And why are you using the ItemIndex instead Value?

ItemIndex is the item index in list (TCollection)

Best Regards.

Re: Item.Value not updating database value

PostPosted: 19 May 2016 14:17
by zsleo
I think you misunderstood.

I am not using grade that value. I have not injected any code.

What I am saying is Item.Value in NOT the value saved to the DB!

Re: Item.Value not updating database value

PostPosted: 19 May 2016 15:52
by Alexander Bulei
Hi,

So, I don't know what are you want...
Explain better the your objective and your problem.

Best Regards.

Re: Item.Value not updating database value

PostPosted: 19 May 2016 21:08
by zsleo
As I said in my first post. The wrong value is saved to DB.

I have not added any extra code.

Re: Item.Value not updating database value

PostPosted: 20 May 2016 09:03
by Alexander Bulei
Hi zsleo,

Don't think this is something with our component.
Please debug and check the ItemIndex.

Best Regards.

Re: Item.Value not updating database value

PostPosted: 20 May 2016 09:20
by zsleo
I have done and have had to write code around the components to solve the problem.

Re: Item.Value not updating database value

PostPosted: 20 Sep 2019 01:32
by sbsllc
I realize this is an old thread but I am running into the same issue as zsleo was. No matter what value I enter in the item.value it will save the itemindex value to the database instead.

I have two items configured. The value of the first item is set to -1 and the value of the second items is set to 0. Whenever an item is selected and the data is saved the value of the first item is always 0 and the value of the second item is always 1.

Isn't the value in the item.value property supposed to be the value saved?

Re: Item.Value not updating database value

PostPosted: 23 Sep 2019 09:29
by Alexander Bulei
Hi sbsllc,

Can you submit the simple testcase?
I can't simulate that issue.

TIA

Re: Item.Value not updating database value

PostPosted: 14 Oct 2019 04:02
by sbsllc
Hi Alexander,

I am very sorry for the delay. I got pulled away on another project.
I am attaching a test case using TClientDataSet.

To reproduce first click insert and select "Yes" then submit. If you then refresh the data in the grid you will see that the value saved was 0 even though I have 10 set for that items value. If you select "No" the value saved is 1 and not 20 which is that items value.

I hope this helps show what I am seeing. Thank you!