例如:
原数据库是以'文本文件'保存的,
原'文本文件'信息如下:(原文件名stud.txt)
学号 姓名 性别 年龄 语文 数学 政治
//上行是说明下列五行是信息,文本文件中信息是以行为单位的
100001 王一 男 20 65 75 80
100002 王二 女 21 60 70 82
100003 王三 男 22 62 78 88
100004 王四 女 23 66 79 85
100005 王五 男 24 68 75 90
想将数据库升级为非'文本文件'格式的,转换后的格式为:
版本 学号 姓名 性别 年龄 语文 数学 政治
//上行是说明下列五行是信息,转换后的信息,用'记事本'打开查看时不是以行为单位的
//但是具体信息如下
Ver:1.40 100001 王一 男 20 65 75 80
Ver:1.40 100002 王二 女 21 60 70 82
Ver:1.40 100003 王三 男 22 62 78 88
Ver:1.40 100004 王四 女 23 66 79 85
Ver:1.40 100005 王五 男 24 68 75 90
原数据库是以'文本文件'保存的,
原'文本文件'信息如下:(原文件名stud.txt)
学号 姓名 性别 年龄 语文 数学 政治
//上行是说明下列五行是信息,文本文件中信息是以行为单位的
100001 王一 男 20 65 75 80
100002 王二 女 21 60 70 82
100003 王三 男 22 62 78 88
100004 王四 女 23 66 79 85
100005 王五 男 24 68 75 90
想将数据库升级为非'文本文件'格式的,转换后的格式为:
版本 学号 姓名 性别 年龄 语文 数学 政治
//上行是说明下列五行是信息,转换后的信息,用'记事本'打开查看时不是以行为单位的
//但是具体信息如下
Ver:1.40 100001 王一 男 20 65 75 80
Ver:1.40 100002 王二 女 21 60 70 82
Ver:1.40 100003 王三 男 22 62 78 88
Ver:1.40 100004 王四 女 23 66 79 85
Ver:1.40 100005 王五 男 24 68 75 90
解决方案 »
- delphi操作sqlserver如何实现每页只显示50条或者100条这种分页的功能?
- 寻找两个控件
- 关于TREEVIEW的问题!!!
- 打印表格时,怎么解决换页时前一页最后一行没有表格线的问题!(在线)
- 关于保存文件(二进制方式)问题,急,急 ,急,求救,
- 高分提问,关于fastScript难题,请各路英雄出手相救!!
- 简单的入门问题(Midas,三层结构)
- 高手请指教->多个Form间怎么互通消息?
- 问题是关于dbGrid,Combobox等的问题,有兴趣可以看一看。
- access的sql语句是如何支持cast or convert 的?icehill()
- DELPHI记录集结构以流的方式文字+图片写入自定义库
- 如何嵌套一个窗体的DLL文件到TabSheet控件中
ALTER TABLE doc_exa ADD column_b VARCHAR(20) NULL2,修改该列的值
update
ss.loadfromfile('...');
for i:=0 to ss.count-1 do
begin
ss[i]:='v1.0 '+ss[i];
end;
ss.savetofile('...');
ss.free;
Delphi:
procedure TStrings.LoadFromFile(const FileName: string);
procedure TStrings.LoadFromFile(const FileName: string; Encoding: TEncoding);
procedure TStrings.SaveToFile(const FileName: string);
procedure TStrings.SaveToFile(const FileName: string; Encoding: TEncoding);
procedure TStrings.SaveToFile(const FileName: string);
begin
SaveToFile(FileName, nil);
end;procedure TStrings.SaveToFile(const FileName: string; Encoding: TEncoding);
var
Stream: TStream;
begin
Stream := TFileStream.Create(FileName, fmCreate);
try
SaveToStream(Stream, Encoding);
finally
Stream.Free;
end;
end;
Listbox1.Items.LoadFromFile(’c:\temp\MyListBoxItems.txt’,TEncoding.UTF8)
ListBox1.Items.SaveToFile(’MyListBoxItems.txt’,TEncoding.UTF8);
unit MainUnit;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus;type
TForm34 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
Label1: TLabel;
Edit1: TEdit;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form34: TForm34;implementation{$R *.dfm}procedure TForm34.Button1Click(Sender: TObject);
begin
ListBox1.Items.Add(Edit1.Text)
end;procedure TForm34.Button2Click(Sender: TObject);
begin
ListBox1.Items.SaveToFile('MyListBoxItems.txt',TEncoding.UTF8);
end;procedure TForm34.Button3Click(Sender: TObject);
begin
if FileExists('C:\temp\MyListBoxItems.txt') then
Listbox1.Items.LoadFromFile('c:\temp\MyListBoxItems.txt',TEncoding.UTF8)
else
ShowMessage('c:\temp\MyListBoxItems.txt not found!');
end;procedure TForm34.Button4Click(Sender: TObject);
begin
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;procedure TForm34.ListBox1Click(Sender: TObject);
begin
Label1.Caption := ListBox1.Items.Strings[ListBox1.ItemIndex];
end;end.