Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DBF - XML - DBF
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Internet applications
Title:
DBF - XML - DBF
Miscellaneous
Thread ID:
00359992
Message ID:
00359992
Views:
48
Hi:

I need any help...

I'm working with ADO 2.5 on Win2000. I need traslate a .DBF to XML and then update a record in the XML file and convert the XML to DBF. I think i'm working with a disconnected recordset... but the Update don' work.

Here it is the code...

TIA

Alberto Rodriguez
********************* BEGIN ********************

set defau to c:\tmp
close all
clear

IF file('table1.dbf')
erase table1.dbf
ENDIF

create table table1 (field1 c(10),;
field2 c(10))

for x = 1 to 10
insert into table1(field1,;
field2) values (str(rand()*;
1000),str(rand()*1000))
endfor
close all

*- Lo borramos porque sino da error al guardarlo.¿..?
IF file('myXMLfile.xml')
erase myXMLfile.xml
ENDIF

oConn = CreateObject('ADODB.connection')
oRS = CreateObject('ADODB.Recordset')

cCnString= 'Driver=Microsoft Visual FoxPro Driver; ' + ;
'SourceType=DBf;SourceDB=c:\tmp;BackgroundFetch=No;'

oConn.Open(cCnString)

oRS.Open('select * from table1',oConn)
oRs.Save('c:\tmp\myXMLfile.xml',1)

oRs.Close

oRS = CreateObject('ADODB.Recordset')

oRs.Open ('c:\tmp\myXMLfile.xml', 'Provider=MSPersist;', , , 2)

*- Problems here...
oRs.fields('field2').value = ' 999'
oRs.Update
*EndIf

*- Lo guardamos con otro formato
oRs.Save ('c:\tmp\myXMLfile.adtg', 1)

oRs.Close

*finalmente vuelves


*If there is no ActiveConnection, you can open with defaults.
oRst.Open 'c:\tmp\myXMLfile.adtg'

*Connect to the database, associate the Recordset with the
* connection,
*then update the database table with the changed Recordset.
cCnString= 'Driver=Microsoft Visual FoxPro Driver; ' + ;
'SourceType=DBf;SourceDB=c:\tmp;BackgroundFetch=No;'

oConn.Open(cCnString)
oRs.ActiveConnection = oConn
oRs.UpdateBatch

oRs.Close
oConn.Close

************************** END ****************
Reply
Map
View

Click here to load this message in the networking platform