Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Disconnected Record Sets
Message
De
08/05/2001 09:18:01
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00504588
Message ID:
00504647
Vues:
20
This won't work if the user has a need for "real" offline edits like turning off the laptop and going home.

>Hi!
>
>You do not require to re-open recordset to go online. Just assign ActiveConnection property and update data. New assigned connection should be opened and valid for that recordset. In addition, there are also certain options you shoudl set. Example:
>
>
>oConnection = createobject("ADODB.Connection")
>oConnection.CursorLocation = adUseClient && required!!!
>oConnection.ConnectionString = ...
>oConnection.Open()
>
>rs = createobject("ADODB.Recordset")
>rs.CursorLocation = adUseClient && required!!!
>rs.Open(pcQuery, oConnection, pnCursorType, pnLockType, pnType) && options here - any vald options
>
>rs.ActiveConnection = .NULL.
>
>oConnection.Close
>
>
>... do offline work
>
>oConnection.Open()
>rs.ActiveConnection = oConnection
>
>rs.UpdateBatch adAffectAllChapters
>oConnection.Close
>rs.Close && here you lose all data. Reopening causes the same.
>
>
>HTH.
>
>>Hi.
>>
>>I was trying to use Disconnected Record Sets in a little test.
>>I want the application to be able to go offline. Make edits then come back on and syncronize...
>>
>>Here what I tried..
>>
>>
>>The question is why can I not make offline edits?
>>When I run the updatebatch I get no errors but when I reopen the data was not been saved.
>>
>>
>>
>>**TJM Offline test....Persistant
>>     lcRsFileName="c:\temp\styless.rs"
>>     oRecordset.Save(lcRsFileName)
>>**make Change not possible at this point.
>>
>>**Go offline!
>>     oRecordSet.close()
>>     oConnection.close()
>>**her the application might be shutdown
>>
>>
>>**Here we restart application
>>	oConnection = CreateObject("adodb.connection")
>>	oConnection.Provider = "SQLOLEDB.1"
>>	oConnection.ConnectionString = "Persist Security Info=False;Password=quest;User ID=quest;Data Source=TJM"
>>	
>>	oRecordset = CreateObject("adodb.recordset")
>>	oRecordSet.CursorType = 3  	   &&Open Static Client default 0
>>	oRecordSet.LockType = 4		  &&Lock Batch Optistic  default 1
>>	oRecordSet.CursorLocation = 3   &&Client Side Cursor  default 2
>>	oRecordset.Open("c:\temp\styles.rs")
>>
>>	**try an update
>>
>>        oRecordSet.fields("moc001").value='assfsadfsdafasd'
>>	oRecordSet.updateBatch
>>
>>
>>	**Simulate closing Application
>>	oRecordSet.close
>>		
>>	***try to go online
>>	oConnection = CreateObject("adodb.connection")
>>	oConnection.Provider = "SQLOLEDB.1"
>>	oConnection.ConnectionString = "Persist Security Info=False;Password=quest;User ID=quest;Data Source=TJM"
>>	oConnection.Open
>>
>>	**Open and Save Offline Record Sets.
>>		oRecordset = CreateObject("adodb.recordset")
>>		oRecordSet.CursorType = 3  	   &&Open Static Client default 0
>>		oRecordSet.LockType = 4		  &&Lock Batch Optistic  default 1
>>		oRecordSet.CursorLocation = 3   &&Client Side Cursor  default 2
>>		oRecordset.Open("c:\temp\styles.rs")
>>		oRecordSet.activeconnection=oConnection
>>		oRecordSet.updatebatch
>>
>>
>>
>>When I first reopen the record set after the offline change I can not find the
>>data I saved.
>>
>>Has anyone worked with discconected record sets?
>>
>>Thanks
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform