Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datawindow update error

Status
Not open for further replies.

ribag

Programmer
Jan 5, 2008
6
HU
Hi everyone!

In a datawindow I'm using a checkbox editstyle numeric field. When the user clicks on the row, I programmatically change the vaule of the field from 0 to 1 or vice versa.

It's works as simple as sounds, except for the situation when the user clicks on the row twice (or any even numbers). In that case the value of the field will be the original, but the status of the row will be modified.
When the user press the update button it generate the error message: "Row Changed between retrieve and update"

If I change any additional field in the row (e.g a timestamp) it works fine.

Please give me some advice!

I'm using Pb10 and mySQL 5.0 .

Regards,
Ribag
 
So, the it doesn't matter what the initial value is, 0 or 1... It's just occurring when you set back to the original value?

I'm not sure what the issue is, but one thing that could eliminate it would be to loop through the datawindow's values to see if it really is modified, using the dw.GetItem[Number, String, etc]( row, col, Buffer, T/F ), and then compare the T/F values to see if they are the same.
 
No the original value doesn't matter.

I tried Your suggestion and checked the values in the Primary! buffer.
It contained the expected values.
I started the test with the value 0 in the field (not checked) :
- when I clicked once, the T (original) was 0 and the F (current) was 1 (update successful)
- when I clicked twice both T and F was 0 . (update failed with error message)

In the sqlpreview event the sqlsyntax is:
UPDATE settings SET settings_value_b = ? WHERE settings_id = ? AND settings_name = ? AND settings_value_b = ?

This is the same syntax when the update successful.

Any idea??

Thanks:
Ribag
 
Sorry thekl0wn,
Maybe it is important, but i don't know what does it mean in-line. I doublechecked the datawindow update parameters, but i dont find any relevant settings there. I tried all of the where clause settings but the outcome was the same.
 
Maybe the problem is Mysql relevant.
I reproduced it with any kind of fileds.
But in the EAS demo DB it works in the expected way.
 
Sorry about that... by in-line, I simply meant in-check, or correct. The Update Properties bite me in the butt quite often!

This is frustrating, because I made one doing the exact same thing this afternoon without a problem...
 
I gave it up.
Using the workaround (updating last_access datetime field before every update) i can continue my work, but it is very annoying. :-(
 
Is it a primary key ? If not, then in the 'Update Properties', 'Where Clause for Update/delete' section turn on the 'Key Columns' radio button. That way the datawindow won't check if the other columns (including your checkbox) have changed before it updates. It is not as secure that way but if security isn't an issue it might be an easy way out.
 
Hi Lealow,
Thanks for Your reply. Unfurtunately it is not the solution. I already checked this. Actually i tried all of the where clause options. Now i'm assuming that is a bug. Maybe a patch or upgrade to the pb or the mysql (maybe the odbc driver) would be the solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top