×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SQL Update() does not update

SQL Update() does not update

SQL Update() does not update

(OP)
Hi,

I have this code which does not update

CODE --> VFP

Update PERMISSION ;
SET ;
PERMISSION.Permissionnmbr = curPermiss5a.Permissionnmbr , ;
PERMISSION.Permissionfrom = curPermiss5a.Permissionfrom , ;
PERMISSION.Permissiontill = curPermiss5a.Permissiontill , ;
PERMISSION.Permissiondate = curPermiss5a.Permissiondate ;
FROM curPermiss5a ;
WHERE PERMISSION.ID = curPermiss5a.ID
lnRec = _Tally
la =  AERROR(aPermis)
If lnRec = 0
	lnError = 8
Else
	m.llSuccess = Tableupdate(.T.)
Endif
If llSuccess = .F.
	lnError = 16
Endif

Select VERZEKNR 

  • The cursor curPermiss5a all fields have values.
    The values of the both ID's are equal
    aPermis does not show any update errors
    My Errorcatcher is not activated
    lnRec = 1
and still the fields of the table to be updated, PERMISSION, remains blank
Any clue how to find what is the cause of this unwanted behavior?

I keep on puzzling.

Koen

RE: SQL Update() does not update

What is the buffering/locking state of curPermiss5a? And how is it created? By a CA or updatable view on permission.dbf?

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: SQL Update() does not update

(OP)
Olaf,
Buffering of cursor curPermiss5a was 5, I changed to 1: no effect.
Cursor was created with a SQL Select from 3 dbf's

CODE --> vfp

Select ;
T1.Id, ;
T1.Permissionfrom,	;
T1.Permissiontill,	;
T1.Permissionnmbr,	;
T1.Permissiondate, ;
T1.Permissionrqst, ;
T1.iVerzeknr, ;
T2.Permissionrecvd, ;
T2.ID As VerzeknrID, ;
T3.chemoenz, ;
T3.nierdialyse, ;
T3.ID As NAWID ;
FROM PERMISSION T1 With (Buffering = .T.) ;
JOIN VERZEKNR T2 With (Buffering = .T.) On T2.ID = T1.iVerzeknr ;
JOIN NAW T3 With (Buffering = .T.) On T3.ID = T2.iNAW ;
INTO Cursor curPermiss5a Readwrite NOFILTER 

Regards,
Koen

RE: SQL Update() does not update

Koen,
Did you try FLUSH FORCE command?

Regards,

Ilya

RE: SQL Update() does not update

A readwrite cursor is writable, but does not update underlying tables.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: SQL Update() does not update

It would only by chance, if you do a single table query and get a filter cursor.

An updatable cursor needs to be a view or CA, because you already get an error 1468, if you try to CURSORSETPROP("SendUpdates", .T.).

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: SQL Update() does not update

(OP)
Olaf,

It is not the cursor curPermiss5a which needs to be updated it is the DBF Permission.DBF which needs to be updated.
This technique to update a dbf with the content from a cursor is used for 'ages'.

@Ilya,
The lowlevel 'Flush Force' was not issued, I will give it a try.

Regards,
Koen

RE: SQL Update() does not update

Koen, fantastic, then it should be easy to set this up as it's necessary and you'll get this yourself.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: SQL Update() does not update

(OP)
Olaf,

sorry I think I donot follow. What is fantastic?

Regards,
Koen

RE: SQL Update() does not update

What do you see when you use a query with the same conditions?

CODE

SELECT * FROM PERMISSION ;
 JOIN curPermiss5a ;
   ON PERMISSION.ID = curPermiss5a.ID 

Tamar

RE: SQL Update() does not update

(OP)
Tamar,
I get a query with one record, correct according to the code, with all fields from PERMISSION.DBF and curPermiss5a with data from their relevant sources.
Koen

RE: SQL Update() does not update

Okay, so what do you see if you check the table right after the UPDATE command?

Tamar

RE: SQL Update() does not update

(OP)
Tamer,
I notice that the fields are not updated, they remain blank as initially.
You know I lost lust to find out what is going on here. So, since it is after all only an update of a few fields, I changed my code from

CODE --> VFP

SQL..Update 
to a

CODE --> VFP

REPLACE Permissionnmbr WITH curPermiss5a.Permissionnmbr,; 
etc. works fine and I can go on.
Thanks for your advise and sorry for bothering.
Koen

RE: SQL Update() does not update

how are you checking the table after the update?

Could this be SET SQLBUFFERING ?

hth

n

RE: SQL Update() does not update

(OP)
Nigel,

You can check the Buffering with ln= Cursorgetprop('Buffering', cTableAlias)
if ln = 5 Optimistic Table Buffering is on

Regards,

Koen

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close