Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding ADODB and MSXML
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Understanding ADODB and MSXML
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01555719
Message ID:
01555719
Views:
68
I am looking at the Cetin's code of extracting data from an excel into a cursor. What I get is the following:

1. The names of the fields of the cursor are taken from the 1st row of the spreadsheet.
Question: Is this always the case?
2. The types of fields are MEMO for all character fields.
Question: Can I define types of the fields instead of all Char fields getting MEMO type:

This is the snipet of the code:
lcConStr =  'Provider=Microsoft.ACE.OLEDB.12.0;'+;
  'Data Source='+m.lcDataSource+';'+;
  'Extended Properties="Excel 12.0;HDR='+;
  IIF(m.lFirstRowHasHeader,'Yes','No')+'"'

m.tcQuery = 'select * from [sheet1$]'
m.tcCursorName = 'C_SHEET1'

Local oConn As 'ADODB.Connection'
  Local oRS As ADODB.RecordSet
  oConn = Createobject('ADODB.Connection')
  oConn.Mode= 1  && adModeRead
  oConn.Open( m.tcConStr )
  oRS = oConn.Execute(m.tcQuery)

  *-- This code I don't understand.  Could it be the key in setting up my own types for the fields?
  Local xDOM As 'MSXML.DOMDocument'
  xDOM = Createobject('MSXML.DOMDocument')
  toRS.Save(xDOM, 1)
  Xmltocursor(xDOM.XML, m.tcCursorName)

  oRS.Close
  oConn.Close
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Reply
Map
View

Click here to load this message in the networking platform