zoukankan
html css js c++ java
TClientDataSet的操作
记性不好了,唉,这里写个被忘
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, DBClient, StdCtrls;
type
TForm1
=
class
(TForm)
Button1: TButton;
Button2: TButton;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R
*
.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
ClientDataSet1.LoadFromFile(
'
E:\TEMP.XML
'
);
end;
procedure TForm1.Button1Click(Sender: TObject);
var tempClientDataSet : TClientDataSet;
begin
tempClientDataSet :
=
TClientDataSet.Create(self);
try
with tempClientDataSet
do
begin
with FieldDefs.AddFieldDef
do
begin
DataType :
=
ftInteger;
Name :
=
'
Field1
'
;
end;
with FieldDefs.AddFieldDef
do
begin
DataType :
=
ftdatetime;
Name :
=
'
Field2
'
;
end;
createDataSet;
appendRecord([
3
,now]);
appendRecord([
1
,now]);
appendRecord([
2
,now]);
tempClientDataSet.AddIndex(
'
T1
'
,
'
Field1
'
, []);
tempClientDataSet.IndexName :
=
'
T1
'
;
first;
while
not EOF
do
begin
showmessage(intToStr(FieldByName(
'
Field1
'
).AsInteger)
+
formatdatetime(
'
yyyymmdd HH:NN:DD
'
,FieldByName(
'
Field2
'
).AsDateTime ));
next;
end;
end;
tempClientDataSet.SaveToFile(
'
E:\TEMP.XML
'
);
finally
tempClientDataSet.Free;
end;
end;
end.
查看全文
相关阅读:
dmesg 时间转换
[转载]Linux性能测试 ss命令
[转载]Python高效编程技巧
[转载]Latency Numbers Every Programmer Should Know
几道有意思的智力面试题
单网卡多ip配置
[转]Office visio 2007 打开后死机,提示关闭
[转]C++的五种内存存储区
[转]Linux性能测试 pmap命令
利用wojilu框架仿一个网站的全过程(Step by Step利用wojilu框架开发网站系列序言)
原文地址:https://www.cnblogs.com/enli/p/642359.html
最新文章
安装编译openssl
MFC读取图片发送
c++ 读取图片RGB
Linux下如何用QT检测到U盘已经插入,并实现mount与umount
不能以root用户运行chrome
qt 检测u盘插入
libusb检测U盘插入
qt 解析XML
检测usb
(转)使用互斥锁
热门文章
<转>SQLite3 数据类型
windows XP 开机自动运行程序方法
Symbian c++ MCameraObserver类的方法解释
(转)#pragma once和#ifndef的区别
AutoHotKey(AHK)笔记
(载)对于c++中实现单例的讨论
(转)windows进程间通讯的各种方法
<笔记>关于char, wchar_t, TCHAR, _T(),L,宏 _T、TEXT,_TEXT、L
<笔记>#define afx_msg解析
[转载]Linux性能测试 top衍生命令 atop/htop/slaptop
Copyright © 2011-2022 走看看