* 1. Create the connection and set its propeties. This works fine. * 2. Create views with the selects I have in a table * Typical mRemoteSel is [SELECT * from dbo.plsis] or [SELECT * from dbo.plsis plsis] lc = [CREATE SQL VIEW "]+ALLTRIM(TablDict.cViewName) ; + [" REMOTE CONNECTION "coneccion" AS ] ; + ALLTRIM(TablDict.mRemoteSel) &lc * Populate aFlds with the information about the updateable fields from the view ... AFIELDS('aFlds',lcViewName) && Populate the array with the field definitions * Remove fields that are not updateable SetViewProperties(lcViewName,lcMainTable,.F.) PROCEDURE SetViewPropeties LPARAMETERS pViewName, pSourceTable, pPKUpdateable DBSetProp(pViewName, 'View', 'UpdateType', 1) DBSetProp(pViewName, 'View', 'WhereType', 1) && Key only DBSetProp(pViewName, 'View', 'FetchMemo', .T.) DBSetProp(pViewName, 'View', 'SendUpdates', .T.) DBSetProp(pViewName, 'View', 'UseMemoSize', 255) DBSetProp(pViewName, 'View', 'FetchSize', 100) DBSetProp(pViewName, 'View', 'MaxRecords', -1) DBSetProp(pViewName, 'View', 'Tables', pSourceTable) DBSetProp(pViewName, 'View', 'Prepared', .F.) DBSetProp(pViewName, 'View', 'CompareMemo', .T.) DBSetProp(pViewName, 'View', 'FetchAsNeeded', .F.) DBSetProp(pViewName, 'View', 'FetchSize', 100) DBSetProp(pViewName, 'View', 'Comment', "") DBSetProp(pViewName, 'View', 'BatchUpdateCount', 1) DBSetProp(pViewName, 'View', 'ShareConnection', .F.) for li = 1 to alen(aFlds,1) if li = 1 dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'KeyField', .T.) else dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'KeyField', .F.) endif if li <> 1 or (pPKUpdateable) dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'Updatable', .T.) dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'UpdateName', pSourceTable+'.'+aFlds[li,1]) DO CASE CASE aFlds[li,2]$'NF' dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'DataType', ; aFlds[li,2]+'('+ltrim(str(aFlds[li,3]))+','+ltrim(str(aFlds[li,4]))+')') CASE aFlds[li,2]='C' dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'DataType', ; aFlds[li,2]+'('+ltrim(str(aFlds[li,3]))+')') CASE aFlds[li,2]='B' dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'DataType', ; aFlds[li,2]+'('+ltrim(str(aFlds[li,4]))+')') CASE aFlds[li,2]$'DTIMGL' dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'DataType',aFlds[li,2]) OTHERWISE dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'DataType', ; aFlds[li,2]+'('+ltrim(str(aFlds[li,3]))+','+ltrim(str(aFlds[li,4]))+')') ENDCASE else dbsetprop(pViewName+'.'+aFlds[li,1], 'Field', 'Updatable', .F.) endif endfor