Jean,

>>    both Update and New records are getting committed with TABLEUDPATE to
>>SQL server
>>    but  still wondering why aUpdateInfo  still show -1 value  even though
>>lSaved is returning .T. ?
>>   
>>        lSaved = TABLEUPDATE(2, .F., 'Crsmwtest', aUpdateInfo)
   
So was it the change I suggested (adding the PK to UpdateNameList) that got
it working?   

You can use AERROR() right after the TABLEUPDATE line to see what the error
is that caused the -1 in aUpdateInfo:

IF aUpdateInfo(1) = -1
        AERROR(MyError)
        SUSPEND && or SET STEP ON
        *Then examine the MyError array to see the error info
ENDIF

>>    2nd question:
>>     if you have a table with many fields as many as 200 fields, how would
>>you specifiy the
>>  all these fields in UpdateNameList and in UpdatefieldList without typing
>>them?
>>   is there any way to tell CursorAdapter to update all fields with one
>>single keyword?

No, there is no shortcut if you want an updatable CursorAdapter (those
properties don't matter if you just want to read data through CA). For
updatable, however, the UpdateNameList and UpdatableFieldList must contain
all the fields you want to insert or update (plus the PK in UpdateNameList
even if it's auto-assigned in the database).  I usually build my
CursorAdapters for all tables from a data dictionary, using a custom-written
generation program to avoid the tedium of typing fieldnames.

   
>>   Another question,
>>    how would commit a deleted record  with CursorAdapter?

Delete the record in the updatable cursor and call TableUpdate just as you
do for inserts and updates.  When you call TableUpdate, any changes made in
the cursor will be applied to the backend table, whether inserts, updates or
deletes. CursorAdapter steps through all the changed/added records (changed
includes the delete status being set) and sends a SQL statement for each one
individually.

By the way, you can see exactly what CA is sending to SQL Server by turning
on SQL Profiler to capture the SQL statements being sent. This can be very
helpful in both understanding what CA does and also in troubleshooting. 

David Stevenson 

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 269.23.16/1434 - Release Date: 5/15/2008
7:24 AM
 



_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://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.

Reply via email to