General information
Category:
Internet applications
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only