No, the name is irrelevant, you give the result dataset a cursor name of your own choice.
Dave -----Original Message----- From: ProFox [mailto:[email protected]] On Behalf Of Ajoy Khaund Sent: 14 February 2013 14:31 To: [email protected] Subject: Re: Update table using SPT Thanks Dave. Finally understood what the MakeUpdateable.prg was all about. I use to see people refering to it but never realized what it was for. Thanks Paul McNett. Is there any problem if the name of the backendtable & local alias has the same name. Since I am converting Vfp forms life will be easier if they can be both same. Just want to know in advance so that I don't fall into any trap. Ajoy Khaund On Thu, Feb 14, 2013 at 1:41 PM, Dave Crozier <[email protected]> wrote: > 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:[email protected]] 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: [email protected] > Mail: [email protected] > 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: [email protected] 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/[email protected] ** 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.

