Delphi6,7提供ADO RecordSet的LoadFromFile和SaveToFile方法
与Xml交互:
procedure LoadFromFile(const FileName: WideString);
Description
Call LoadFromFile to load the recordset for the calling ADO dataset component from a file. If the loading operation fails, the current recordset is neutralized (set to nil), the dataset component remains inactive, and an EOleException exception is raised. If the attempt to load data from a file is successful, the ADO dataset component is automatically activated and the data made available.
FileName is a string containing the name of the file.
LoadFromFile closes the dataset component before loading the recordset from the file specified in FileName.
其xml文档编码格式要求为utf8:
<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 />
</s:AttributeType>
在D6中RecordSet.LoadFromFile后,RS中数据是存在的,但rs.FieldByName('C07').ToString Throw a Error
手工改变xml文件,将dt:maxleng配置为10,没有错误,但该字段被截取成10位长度了
看来只需在.Net端生成xml时将dt:maxleng配置得足够大
然而很不幸,dt:maxleng>8200+时(具体为多少没测试,当时急着改BUG)
出现问题和dt:maxleng=-1一样
看来只有使用小于8000的文本了