David,
It is working now.
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)
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?
Another question,
how would commit a deleted record with CursorAdapter?
Thanks in advance for all your help on this..
Jean Haidar
[EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Jean,
You don't have your primary key listed in the UpdateNameList property,
which is used as a cross-reference between the fields in your cursor and
the fields in the backend table. Change UpdateNameList to this and see if
it works:
lodo.UpdateNameList="cust_id MWTEST.cust_id, name_first MWTEST.name_first,
name_last MWTEST.name_LAST"
NOTE: The PK does not have to be in the UpdatableFieldList, but it should
be in the UpdateNameList so CursorAdapter has the info it needs to
construct the WHERE clause of the Update statement it will send to the
backend.
David Stevenson
> Password and Userid are empty and it there is a issue with the conenction
> string then I would have not connected probably
> the CursorFill is working properly, it is the TABLEUPDATE that I am
> having issue with ?
>
> Jean Haidar
> [EMAIL PROTECTED]
>
> Jeff Johnson wrote:
> I do not work with cursoradapters but one thing I noticed is that you
> have a password and userid in addition to Trusted_Connection = Yes. I
> use trusted_connection with my SQL tables, but I don't use any passwords
> or ids in the connection string.
>
> HTH
>
> Jeff
>
> Jeff Johnson
> [EMAIL PROTECTED]
> SanDC, Inc.
> 623-582-0323
> Fax 623-869-0675
>
> Jean Haidar wrote:
>> trying to update a test simple SQL table using CursorAdapter class from
>> VFP9
>> I am always getting -1 value in aUpdateinfo after TBALEUPDATE command
>>
>> here is my code:
>> _________________________________________
>> ******************************************************************************
>> * SQL table MWTEST contains the following fields
>> * CUST_ID N(14,0), Name_first varchar(15), name_last varchar(25)
>> *
>> *******************************************************************************
>> lodo = CreateObject("CursorAdapter")
>> lodo.DataSourceType="ODBC"
>> LOCAL lcSQLSrvType,lcSQLSrvName,lcUserid,lcPassword,lcDB
>> lcSQLSrvType=[SQL SERVER]
>> lcSQLSrvName=[HAIDAR-JEAN-J\SQLEXPRESS_JH]
>> lcUserid=[]
>> lcPassword=[]
>> lcDB=[MYTESTDB]
>>
>> lcConStr=
>> [uid=]+lcUserid+[;pwd=]+lcPassword+[;server=]+lcSQLSrvName+[;driver=]+lcSQLSrvType+[;database=]+lcDB+[;DSN='';Trusted_Connection=Yes]
>> lodo.DataSource=SQLStringConnect(lcConStr)
>> lodo.alias=[crsmwtest]
>> lnCust_ID=[12345678901234]
>> lodo.SelectCmd="select * from mwtest where cust_ID= " +
>> ALLTRIM(lnCust_ID)
>>
>> *-- this working fine, crsmwtest cursor is open
>> lodo.CursorFill()
>>
>> *- update
>> lodo.ALLOWUPDATE = .T.
>> lodo.ALLOWinsert = .T.
>> lodo.ALLOWDELETE=.T.
>> lodo.tables=[MWTEST]
>> lodo.KeyFieldList = "CUST_ID"
>> lodo.UpdatableFieldList="name_first,name_last"
>> lodo.UpdateNameList="name_first MWTEST.name_first, name_last
>> MWTEST.name_LAST"
>>
>> lodo.WHERETYPE = 3 && key and modified fields
>>
>> lodo.UPDATECMD=[]
>>
>> *-- aUpdateinfo is populated with -1
>> lSaved = TABLEUPDATE(2, .F., 'Crsmwtest', aUpdateInfo)
>>
>>
>> *------------------------------------------------------------------
>>
>> * I also tried populating populating .UPDATCMD as follows
>> * But still no Luck
>> * Cannot get the Tableupdate to work???
>>
>>
>> lodo.KEYFIELDLIST = []
>> lodo .TABLES = []
>> lodo.UPDATABLEFIELDLIST = []
>> lodo.UPDATENAMELIST = []
>>
>> *-- not working ( aUpdateInfo =-1)
>> lnCust_ID=lnCust_ID=[12345678901234]
>>
>> lodo.UPDATECMD = [update MWTEST SET ] ;
>> + [name_last = "ZZZZ" ]
>> + [where cust_ID= ] + ALLTRIM(lnCust_ID)
>>
>> *-- this is not working (aUpdateInfo =-1)
>> *!* lodo.UPDATECMD = [update MWTEST SET ] ;
>> *!* + [name_last = ?RTRIM(crsMWTEST.name_last) ] ;
>> *!* + [where CUST_ID = ?crsMWTEST.CUST_ID]
>>
>>
>>
>>
>> how can I find out why is causing TABLEUPDATE to fail?
>>
>> HELP!
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --- 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://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.