The original code creates a structure array from a table and then uses that array to make a cursor
CREATECURSOR (m.lcResult) FROMARRAY laField
- if you take a table that has triggers, make an array, then try and make a cursor from that array, it will crash. You need to remove the triggers.
That was problem #1.
Problem #2 was that creating that cursor from an array will not work with autoinc, which you addressed by this:
STORE 0 TO; laField[m.liField, 17]; && NextValue for autoincrementing , laField[m.liField, 18]&& Step for autoincrementing
But that is not necessary. But you do need this:
laField[m.liField, 5] = .T. && Null values allowed laField[m.liField, 9] = '.NULL.'&& Field default value
The problem #3 is that the XMLTOCURSOR function does not work with any autoinc fields. The reason for this is that the autoinc fields throw off errors that crash the process. The VFP docs say only way around this is to turn off the autoinc error and turn it back on like this:
LOCAL lcAINStat lcAINStat = CURSORGETPROP("AutoIncError",m.lcResult) =CURSORSETPROP("AutoIncError", "off", m.lcResult)*XMLToCursor(m.tcXML, m.lcResult, 8192)* TBV put it back =CURSORSETPROP("AutoIncError", lcAINStat, m.lcResult)