Re: Unable to persist/save ADO records



Actually I used ADODB later. For your question, ADOR is a cousin of ADODB.
This is whjat is in the documentation: 'ADOR library is a lighter weight
client that allows for the manipulation of an existing recordset on the
client.' It does not have things like connection object etc. I did that to
make it faster and use little memory

"Mark J. McGinty" wrote:

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:A