Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Arghhh! VFP & MTS= The nightmare never end?
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Arghhh! VFP & MTS= The nightmare never end?
Divers
Thread ID:
00639670
Message ID:
00639670
Vues:
66
Hi,

I try to do this very simple task:

1- Get a disconnected ADO 2.6 recordset with data of a Sql Server database from a VFP COM server.
2- Update in the client
3- Send the recordset to the COM VFP server, update it and refresh the changes..

I have this dummy test:

1- PRG with the call:
LOCAL loSrv,loAdo as ADODB.Recordset

*-- Basura.Basura is the COM server

*-- Uncomment to use the VFP class
*loSrv=NEWOBJECT('basura','d:\basura\basura.vcx')
loSrv=CREATEOBJECT('basura.basura')
CLEAR
loAdo=loSrv.Obtener()

IF VARTYPE(loAdo)='O' AND !ISNULL(loAdo)
?'Registros'+STR(loAdo.RecordCount)
?'Source '+loAdo.Source

loAdo.AddNew()
loAdo.Fields('Cod').Value='01'
loAdo.Update

loSrv.Actualizar(loAdo)
ENDIF


2- The code IN the vfp server

DEFINE CLASS basura AS custom OLEPUBLIC


Name = "basura"


PROCEDURE actualizar
LPARAMETERS loAdo as ADODB.Recordset


LOCAL lcCon as String,lcSql as String,loCon as ADODB.Connection

lcCon="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Basura"


loCon=CREATEOBJECT('adodb.Connection')

loCon.Open(lcCon)

*loAdo=CREATEOBJECT('adodb.recordset')

loAdo.ActiveConnection=loCon

loAdo.UpdateBatch()

loAdo.ActiveConnection=NULL
ENDPROC


PROCEDURE obtener
LOCAL loAdo as ADODB.Recordset,;
lcCon as String,;
lcSql as String,;
loCon as ADODB.Connection

loCon=CREATEOBJECT('adodb.Connection')
lcCon="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Basura"
lcSql="SELECT * FROM Prueba"

loCon.Open(lcCon)

loAdo=CREATEOBJECT('adodb.recordset')

loAdo.CursorLocation= 3 && adUseClient
loAdo.LockType= 4 && adLockBatchOptimistic
loAdo.CursorType= 3 && adOpenStatic
loAdo.ActiveConnection=loCon

loAdo.Open(lcSql)

loAdo.ActiveConnection=.NULL.

RETURN loAdo
ENDPROC


ENDDEFINE

If you want reproduce the code, create a Sql Database called "basura2 and 1 table called "Prueba" with the column "Cod" char(3)

Incredible, when you out the server inside MTS/COM+ and you run the test, the source is returned blank!!!! That is NOT good because this meaning thta subsecuent calls fail, beecause the source is empty and is impossible call Resync, Requery, etc...!!!

I buy VFP 7 *dreaming* that this problem is gone...

I spend 3 monts in a lot of problem with VFP (and 2 with Win98). In this moment i like to return to the past, send VFP to the trash, say to my boss try best with delphi and get the job done in half or less of the time (i spend 1 year in this project...) But now this is not a option. I need a solution fast.... Or i lost $2200 dollars for this things...
The Life is Beautiful!

Programmer in
Delphi, VS.NET
MCP
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform