Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SPT, 2 handles: how to set up updatable grid
Message
De
06/04/2005 15:33:41
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
 
 
À
06/04/2005 14:01:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00981560
Message ID:
01002059
Vues:
41
Inge,

This creats an update statement. Opps, I just noticed I used the Insert syntax instead of update. See my changes below. The addQuotes function is used to add an additional ' when one is in the text string to update.




>Help me with this. I do not know what does this do?
>
>
>>
function makeupdate()
  text to lcSql textmerge noshow pretext 7
    update yourtable set col1 = <<addQuotes(col1)>>,col2 = <<col2>> 
    where tablepk = <<tablepk>>
  endtext
  return lcSql
endfunc

>>FUNCTION addQuotes(tcString)
>>	LOCAL lcRet
>>	IF TYPE(tcString) == "C"
>>		IF EMPTY(tcString)
>>			lcRet = "null"
>>		ELSE
>>			lcRet = STRTRAN(tcString,"'","''")
>>			lcRet = "'"+ALLTRIM(lcRet)+"'"
>>		ENDIF
>>	ELSE
>>		lcRet = NVL(tcString,'null')
>>	ENDIF
>>	return lcRet
>>ENDFUNC
>>
>>
>>
>>>The 3rd cursor is created with a basic SELECT statement (not SQLEXEC with handle)? How do I make this 3rd cursor updatable?
>>>Thanks.
>>>
>>>
>>>
>>>
>>>>Inge,
>>>>
>>>>You will have to select the data into two different cursors. You can then select into a third cursor joining the data form both or you can index one of them and use "set relation". Either way, you will have to join the data together from the cursors created with the sqlexec().
>>>>
>>>>
>>>>
>>>>>I'm using SPT (ODBC).
>>>>>I have 2 different handles since I have 2 different database in 2 different paths/locations (2 different connection strings).
>>>>>
>>>>>I have a grid with text box.
>>>>>Currently the text box shows employee ID.
>>>>>I want to show Employee name instead.
>>>>>The employee ID came from the 1st database,
>>>>>but the names are stored in the 2nd database (different location, different handle).
>>>>>
>>>>>Here's what I currently have for my SQLEXEC:
>>>>>lSuccess=SQLEXEC(THIS.lnHandle1,"SELECT empid FROM mytable1 WHERE refno='&zRefno' ","cCursor1")
>>>>>
>>>>>The grid has .RecordSourcetype=1
>>>>>.RecordSource='cCursor1'
>>>>>
>>>>>How do I code my SQLEXEC so that cCursor1 reflects Employee name (from a different handle, THIS.lHandle2)? Can that be done?
>>>>>What I want is the grid to show employee name instead of the ID.
>>>>>
>>>>>(cCursor1 is set up so that it is updatable -- used CURSORSETPROP).
>>>>>
>>>>>Thank you all.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform