Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Updating through SPT
Divers
Thread ID:
00818150
Message ID:
00818150
Vues:
64
Hi all, I want to update an access DB using SPT. I got the following code to connect to the DB.
	Thisform.Connhandle=0
	Thisform.Connhandle = SQLCONNECT("NominaPopular")
	IF Thisform.ConnHandle>-1
		nSucceded = SQLEXEC(Thisform.Connhandle,"Select * from tbNomina","NominaPopular")
		IF nSucceded>-1
			SetRemoteCursor("NominaPopular")
		ELSE
			Thisform.Mensajes("Could Not Connect To DB!",1)
			IF Thisform.Mensajes("Do You Wish To Continue?",2)=NO
				Thisform.NominaElectronica=.f.
				Thisform.Release
				RETURN 0
			ENDIF 
		ENDIF 
And the following code to set the properties of the cursor
FUNCTION SetRemoteCursor(cNombreCursor)
	CURSORSETPROP("SendUpdates",.t.,cNombreCursor)
	CURSORSETPROP("Buffering",5,cNombreCursor)
	CURSORSETPROP("Tables",cNombreCursor,cNombreCursor)
	CURSORSETPROP("KeyFieldList","fldCodigoEmpleado",cNombreCursor)
	CURSORSETPROP("UpdatableFieldList","fldCodigoEmpleado,fldNumeroCta,fldMonto,fldTipoRegistro,fldNombreEmp",cNombreCursor)
ENDFUNC
The connection is working and retrieving the data but, when I issue the following test code, it doesn't update the remote table.
SELECT NominaPopular
APPEND BLANK
replace fldCodigoEmpleado WITH "10000"
replace fldmonto WITH 5000
replace fldNumeroCta WITH "1234567890"
replace fldNombreemp WITH "Someone's Name"

IF !TABLEUPDATE(0,.f.,"NominaPopular")
	WAIT WINDOW "NO SE pudo Actualiza La Tabla 1"
	SQLROLLBACK(Thisform.Connhandle)
	RETURN 0 
ELSE
	IF SQLCOMMIT(Thisform.Connhandle)=-1
		WAIT WINDOW "NO Se Pudo Actualizar La Tabla 2"
	ELSE
		WAIT WINDOW "Registro Actualizado"
	ENDIF 
ENDIF 
What am I missing here???

TIA,

Enmanuel G.
I'm a mixture of Albert Einstein and Arnold Schwarzenegger. The only trouble is that I got Einstein's body and Schwarzenegger's brain
Suivant
Répondre
Fil
Voir