• 全部
  • API 调用
  • 基础类
  • 控件与界面
  • 数据库相关
  • DataWindow
  • 项目管理
  • Web 应用
  • 脚本语言

一个数据导入、导出的问题 up有分

one_bird 2003-05-19 09:00:44
sql2000数据库 一个表中含有blob字段 50行左右数据
请问如何能把表中的数据导出成一个文件,然后在pb程序中把它导入
...全文
26 点赞 收藏 13
写回复
13 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
flymeng 2003-05-22
up
回复
one_bird 2003-05-19
在pb的数据窗口中blob类型的字段不能retrieve出来吧,我怎么不选不中这一列
回复
kojiang 2003-05-19
SaveAs()保存数据,ImportFile()导入数据

1.dwcontrol.SaveAs( { filename, saveastype, colheading } )
(1)filename:string类型,保存数据窗口内容的文件的文件名
(2)saveastype:以何种方式保存数据窗口中的数据,它的值有:Text! 缺省值,以每行用回车符结束、列之间使用Tab字符分隔的格式保存数据(导入导出数据,一般用此种格式);CSV! 以逗号分隔的形式保存数据,......(自己看PB帮助吧)
(3)colheading:boolean类型,是否在文件的开头加上数据窗口列的标题(缺省值为TRUE)
这些参数都是可选参数。

2.dwcontrol.ImportFile(filename{,startrow{,endrow{,startcolumn{,endcolumn{,dwstartcolumn}}}}})
(1)filename:文件的内容必须是以Tab字符作为分隔符的文本文件
(2)依次是:要复制数据的开始行,结算行,开始列,结算列,数据窗口接收文件中数据的第一列的列号(缺省值为1)
回复
dengxun78 2003-05-19
学习!
回复
zephyr_liyo 2003-05-19
saveas可以,先读出数据,自己搞定,怎么存储你可以看pb的帮助。如下:

Description
Saves the contents of a DataWindow or DataStore in the format you specify.
Controls
DataWindow controls, DataStore objects, and child DataWindows
Syntax

dwcontrol.SaveAs ( { filename, saveastype, colheading } )
Argument Description
dwcontrol The name of the DataWindow control, DataStore, or child DataWindow whose contents you want to save
filename (optional) A string whose value is the name of the file in which to save the contents. If you omit filename or specify an empty string (""), PowerBuilder prompts for the filenameWorking with DataStore objects If you are working with a DataStore, you must supply the filename argument
saveastype (optional) A value of the SaveAsType enumerated data type specifying the format in which to save the contents of the DataWindow object. Values are:?Clipboard! ?Save to the clipboard?CSV! ?Comma-separated values?dBASE2! ?dBASE-II format?dBASE3! ?dBASE-III format?DIF! ?Data Interchange Format?Excel! ?Microsoft Excel format?Excel5! ?Microsoft Excel 5 format?HTMLTable! ?Text with HTML formatting that approximates the DataWindow layout?PSReport! ?Powersoft Report (PSR) format?SQLInsert! ?SQL syntax?SYLK! ?Microsoft Multiplan format?Text! ?(Default) Tab-separated columns with a return at the end of each row?WKS! ?Lotus 1-2-3 format?WK1! ?Lotus 1-2-3 format?WMF! ?Windows Metafile formatPlatform information On Macintosh, PSReport! and WMF! are not supported. The Clipboard! format does not support saving graphs to the clipboard.
colheading (optional) A boolean value indicating whether you want to include the DataWindow's column headings at the beginning of the file. The default value is TRUE.For dBASE files Column headings are always saved for dBASE files.
Return value
Integer. Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is NULL, SaveAs returns NULL.
Usage
If you don't specify any arguments for SaveAs, PowerBuilder displays the Save As dialog box.
A dropdown listbox lets the user specify the format of the saved data.
If the DataWindow is a composite report, Report format (PSReport! value of SaveAsType) is the only reasonable choice.
If the DataWindow object has the RichText presentation style, choosing PSReport! has no effect.

Saving in PowerBuilder for Unicode
If you are using the Unicode version of PowerBuilder, there are some differences in the way the SaveAs function saves the contents of a DataWindow to the several file formats, specifically how character strings are handled and whether files are marked as Unicode files (two extra bytes added to the start of the file).
File type Format of saved file Unicode file
CSV! Comma-separated values saved as Unicode strings Yes
dBASE2!, dBASE3!, DIF!, Excel!, Excel5!, SYLK!, WKS! Character strings saved as ANSI strings
HTMLTable! HTML syntax saved as a Unicode string Yes
PSReport! Only accessible in the version of PowerBuilder (ANSI or Unicode) in which it was saved
SQLInsert! SQL syntax and data values saved as Unicode strings Yes
Text! Text saved as Unicode strings Yes
WMF! Same in the ANSI or Unicode versions of PowerBuilder
回复
one_bird 2003-05-19
我是想把一个表中的所有数据生成一个文件 ,而不是一个bolb字段就生成一个那样太多了
回复
cjt000000 2003-05-19
你为什么不直接用管道导数据呢:)
回复
tchatcha 2003-05-19
selectblob 字段 into :ls_blob
from 表
where 条件;

然后对ls_blob进行操作.
回复
birdslin 2003-05-19
selectblob 字段 into :ls_blob
from 表
where 条件;

然后对ls_blob进行操作.
回复
qqf 2003-05-19
可以导BLOB数据的吗?可不可以试试,将所有的数据生成图片,然后导出。
回复
希望的梦想 2003-05-19
up
回复
gwly 2003-05-19
学习
回复
kojiang 2003-05-19
用代码表,true用1表示,false用0表示,这样不知道行吗
回复
相关推荐
发帖
PowerBuilder
创建于2007-09-28

863

社区成员

PowerBuilder 相关问题讨论
申请成为版主
帖子事件
创建了帖子
2003-05-19 09:00
社区公告
暂无公告