query1.first;
while not query1.eof do
begin
for i:=0 to query1.Fields.count-1 do
begin
ListBox1.Items.Add();//
end;
query1.Next;
end;
解决方案 »
- 回复二楼
- 如何解决Excel文件中的复制图像,粘贴到Delphi的Image控件中
- 系统中,如何双击一个文件名(或者用open),或者其它方法,执行这个文件?比如,一个word文件,点这个文件名,就用word打开
- delphi6编译时总是出现printers错误问题
- 大富翁7真好玩,好开心!使用delphi写的吗?
- 动态创建控件时出错,有代码
- 最小化
- web active控件?
- 怎样截获窗口的最小化、最大化、关闭按钮和双击窗体的标题栏的响应事件???
- 动态库问题----使用delphi 2006 调用低版(delphi 6.0)的DLL时,字符串在Dll里面不全!!(急!!给高分!!)
- 你对数据库的操作很自信吗?
- 服务器的时间
我现在正在写该函数,如果谁有现成的,借来一用,谢谢
那么如何把一个query 中的内容转存成Execl文件?
把txt文件转化为表的时候要忙烦一点,我现在正在写该函数
如果谁有现成的,借来一用,谢谢
就象上面的,自己写一个就是了。
query1.first;
while not query1.eof do
begin
yourstr:='';
for i:=0 to query1.Fields.count-1 do
begin
yourstr:=query1.Fields[i].asstring+';'
//2你的写文件处理。
end;
query1.Next;
end;2、txt文件建议用TFileStream.(大文档)
大概用的着的地方:
fnewlog := TFileStream.Create(outfileName, fmCreate);
flog := TFileStream.Create(infileName.Text, fmOpenRead);
//下一行:
buf[0] := #13; buf[1] := #10;
flog.Position
flog.size
fnewlog.Write(yourstr, length(yourstr));
记得要:yourstr:=yourstr+#
Application.ProcessMessages;
还记得要:
flog.free;
3、text to datebase 除了和上面的反向以外主要就是一个格式化字符串的问题:
给你一个例子:
unction SplitString(const source,ch:string):tstringlist;
var
temp:string;
i:integer;
begin
result:=tstringlist.Create;
temp:=source;
i:=pos(ch,source);
while i<>0 do
begin
result.Add(copy(temp,0,i-1));
delete(temp,1,i);
i:=pos(ch,temp);
end;
result.Add(temp);
end;
调用:
s:=splitstring('afsdfsdaaa|bbfdsfsdb|ccc','|');
for i:=0 to s.Count-1 do
b:=b+s.Strings[i]+#13;
showmessage(b);
s.free;