Delphi与XML文档
同步程序案例
procedure TGetOrderThread.PostDB(webnr:WideString);
var
Err: String;
SetWebnr:WideString;
xmlDoc: IXMLDocument;
root: IXMLNode;
rowc: IXMLNode;//记录数
rows: IXMLNodeList;//主记录列表
row: IXMLNode;
drows: IXMLNodeList;//明细列表
drow: IXMLNode;
i,j,slhj,jlhj:integer;
djhj:real;
begin
//同步数据
xmlDoc := TXMLDocument.Create(nil);
try
xmlDoc.XML.Text:=Webnr;
xmlDoc.Active:=true;
root:=xmlDoc.DocumentElement;
rowc:=root.ChildNodes.FindNode('RowC');
if (rowc.NodeValue>0) and DBconn then
begin
rows:=root.ChildNodes.FindNode('RowS').ChildNodes;
//showmessage('记录数:'+rowc.NodeValue);
for i:=0 to rows.Count-1 do
begin
ADOConn.BeginTrans;
try
row:=rows.Nodes[i];
drows:=row.ChildNodes.FindNode('Drows').ChildNodes;
//showmessage(row.ChildValues['billno']+
// ' 明细记录数:'+inttostr(drows.Count));//显示订单号
if SHelper.Active then SHelper.Close;
SHelper.SQL.Text:=Format(selectStr,[row.ChildValues['billno']]);
SHelper.Open;
jlhj:=0;
slhj:=0;
djhj:=0;
&nb
相关文档:
......
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:XML id="xmlSource">
<node label="grandFather" state="unchecked">
<node label="Father" state="un ......
方法一:
直接弹出UDL对话框:
use
ADOConed;
EditConnectionString(ADOQuery1);
方法二:
⑴、右键---新建---文本文档,重命名为 connSet.udl 。
⑵、双击打开 connSet.udl 按提示操作配置数据库,选择本地或远程数据库,配置好后退出。
⑶、使用Delphi 控件TADOConnection连接代码:
在Form ......
一、Delphi中流的基本概念及函数声明
在Delphi中,所有流对象的基类为TStream类,其中定义了所有流的共同属性和方法。 TStream类中定义的属性介绍如下: 1、Size:此属性以字节返回流中数据大小。 2、Position:此属性控制流中存取指针的位置。 Tstream中定义的虚方法有四个: 1、Read:此方法实现将数据从流中读出。函数原形为: ......