Ajoy,
If you are using SPT and you are retrieving a cursor from SQL Server then you 
set the attributes of the cursor to reflect the update behaviour using 
cursorsetprop().

You need to set the Keyfieldlist, Tables, UpdatableFieldList, Updatetype and 
Wheretype properties. Then the cursor will update automatically using the 
tableupdate() method.

To check if any fields have been updated in the cursor you can use the VFP 
OLDVAL() function to determine if any field has changed or set your own trigger 
in the Interactivechange event of the fields on the form.

As for updating, you can obviously also update individual records using spt  in 
standard SQl i.e update <cursor> set <oldfield> = <newfield> where <where> if 
you want.

It is also worth looking at tableadapters as they take all the hard work out of 
SQL if you are averse to manually programming. Personally I don't like them but 
I do use them on occasions. Create the cursoradapter them to a separate class 
for ease of re-use then you can easily add them into your dataenvironment and 
just use them like native VFP cursors.

On Profox there is a small routine MakeCursorUpdateable (I think) by Paul 
McNett that will point you in the right direction for cursorsetprop() if you 
are confused by the VFP documentation. I must admit that the documentation 
isn't great. Alternatively ask away on here.

I have my own set of classes that do all the SQL stuff automatically that you 
could have but I think it would be too complex at the level you are currently 
at. Once you master cursors in SPT they it may be of use to you.

Dave


-----Original Message-----
From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Ajoy Khaund
Sent: 14 February 2013 03:49
To: Profox
Subject: Update table using SPT

Hi All,

I am working on MSSQL for an app. I am in the learning stage. I am using SPT. I 
have a query.

I have an employee master form.
In the load event I can query and get all the records down to a cursor. I have 
an edit button in the form. Now the user may edit one or more fields in the 
form say having 50 fields.

On save how do I write the UPDATE command if the user has say edited two 
fields. How will the app know that?

TIA

--
Regards,

Ajoy Khaund
Neamati Road
Bhogdoi Mukh
Jorhat 785001
Assam, India

Tel: 91-376-2351288
Cell: 91-94350-92287
Mail: akha...@hotmail.com
Mail: akha...@gmail.com
http://teaanalyst.blogspot.com/


"Walking on water and developing software from a specification are easy if both 
are frozen."
- Edward  V. Berard, "Life-Cycle Approaches"


--- StripMime Report -- processed MIME parts --- multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/bd031ecabf2b60499200aab3dbb4a999012bac9...@ex-a-fpl.fpl.LOCAL
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to