Re: Unable to persist/save ADO records
- From: "Mark J. McGinty" <mmcginty@xxxxxxxxxxxxxxx>
- Date: Mon, 29 Oct 2007 08:24:34 -0700
Forgive my ignorance, but what is ADOR? Why aren't you using ADODB?
-Mark
"Mr. Smart" <MrSmart@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1D0D84FF-D716-43C6-9479-B18F1BD18658@xxxxxxxxxxxxxxxx
Unable to persist/save ADO records
Please take a look at this code:
AP.Save "C:\AP.XML", adPersistXML
AP is an ADOR recordset that I downloaded from a server. The server uses
FoxPro as the middle-tier. The tables are in .DBF format. Though it is
irrelevant in this context, here is the server code:
qryfields = 'Usercode,Surname,Firstname,Othername,Sex, MaritalStatus, ;
DateofBirth,Address,Website,Email,GSMNO,YearGraduated, ;
ExecutiveSummary,Department,Affiliations,Publications,Referees,Languages,
;
Skills,Coursework,Advert,usertype ,newuser'
Querystmt = "SELECT " + Qryfields + " FROM Applicants WHERE usercode = " +
Usercode &&+ " INTO CURSOR " + (cursorname)
oParameterTable = THIS.SQLStatement(Querystmt)
Here is the code in SQLStatement.
FUNCTION SQLStatement
LPARAM SQLStatement
WITH THIS.oTableName
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimisticBatch
.ActiveConnection = THIS.oConnection
SQLStmt = SQLStatement
.Open(SQLStatement)
THIS.RecordsRetrieved = .RecordCount
IF .RecordCount = 0
.AddNew()
ENDIF
.ActiveConnection = Null
ENDWITH
RETURN THIS.oTableName
Even for those that are not into FoxPro, it should be clear. I persisited
this recordset with the .save method (and now in XML format) and sent it
to
the client written in VB. Here is the first part of the VB code that
changes
the (persisted) XML-formatted string to ADOR recordset.
Dim bytewritten As Long, Filename As String
Set AP = New ADOR.Recordset
Filename = "C:\AP.XML"
bytewritten = Utility.stringtofile(apRemoteServer.responseText, Filename,
False)
AP.Open Filename
There is no problem here at all. After manipulating it, I want to return
the
ADOR record back to the server. This is where the problem is. The
problematic
code is the one I gave earlier: AP.Save "C:\AP.XML", adPersistXML. It does
not save the data, but only the structure.
One thing I noticed is that is seems that the code works when there are
about 13 fields or less. In the server code, if I removed the fields after
the ExecutiveSummary field, then, it works! Here is the XML generated
where
we have 14 fields. The data is supposed to be between the schema and data
towards the bottom.
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <s:Schema id="RowsetSchema">
- <s:ElementType name="row" content="eltOnly" rs:updatable="true">
- <s:AttributeType name="usercode" rs:number="1" rs:writeunknown="true"
rs:basetable="Applicants" rs:basecolumn="usercode">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="10"
rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="surname" rs:number="2" rs:writeunknown="true"
rs:basetable="Applicants" rs:basecolumn="surname">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="20"
rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="firstname" rs:number="3" rs:writeunknown="true"
rs:basetable="Applicants" rs:basecolumn="firstname">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="15"
rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="othername" rs:number="4" rs:writeunknown="true"
rs:basetable="Applicants" rs:basecolumn="othername">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="15"
rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="sex" rs:number="5" rs:writeunknown="true"
rs:basetable="Applicants" rs:basecolumn="sex">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="1"
rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="maritalstatus" rs:number="6"
rs:writeunknown="true"
rs:basetable="Applicants" rs:basecolumn="maritalstatus">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="1"
rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="dateofbirth" rs:number="7" rs:writeunknown="true"
rs:basetable="Applicants" rs:basecolumn="dateofbirth">
<s:datatype dt:type="date" dt:maxLength="6" rs:fixedlength="true"
rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="address" rs:number="8" rs:maydefer="true"
rs:writeunknown="true" rs:basetable="Applicants" rs:basecolumn="address">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="2147483647"
rs:long="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="website" rs:number="9" rs:maydefer="true"
rs:writeunknown="true" rs:basetable="Applicants" rs:basecolumn="website">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="2147483647"
rs:long="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="email" rs:number="10" rs:maydefer="true"
rs:writeunknown="true" rs:basetable="Applicants" rs:basecolumn="email">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="2147483647"
rs:long="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="gsmno" rs:number="11" rs:writeunknown="true"
rs:basetable="Applicants" rs:basecolumn="gsmno">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="11"
rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="yeargraduated" rs:number="12"
rs:writeunknown="true" rs:basetable="Applicants"
rs:basecolumn="yeargraduated">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="4"
rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="executivesummary" rs:number="13"
rs:maydefer="true"
rs:writeunknown="true" rs:basetable="Applicants"
rs:basecolumn="executivesummary">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="2147483647"
rs:long="true" rs:maybenull="false" />
</s:AttributeType>
- <s:AttributeType name="department" rs:number="14" rs:writeunknown="true"
rs:basetable="Applicants" rs:basecolumn="department">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxLength="3"
rs:fixedlength="true" rs:maybenull="false" />
</s:AttributeType>
<s:extends type="rs:rowbase" />
</s:ElementType>
</s:Schema>
<rs:data />
</xml>
Is the problem from my code, or is it a bug in ADO. And more importantly,
what can I do to make this work? Thanks very much for the anticipated
assistance. Sorry, if I am too verbose. Just to be sure that the problem
is
well understood
.
- Follow-Ups:
- Re: Unable to persist/save ADO records
- From: Mr. Smart
- Re: Unable to persist/save ADO records
- From: Bob Barrows [MVP]
- Re: Unable to persist/save ADO records
- References:
- Unable to persist/save ADO records
- From: Mr. Smart
- Unable to persist/save ADO records
- Prev by Date: Re: Can I append an ADO recordset to an Access table in one go?
- Next by Date: Re: Unable to persist/save ADO records
- Previous by thread: Unable to persist/save ADO records
- Next by thread: Re: Unable to persist/save ADO records
- Index(es):