DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: pixelcraft
今日帖子: 58
在线用户: 14
导航: 论坛 -> 数据库专区 斑竹:liumazi,waterstone  
作者:
男 huo_v_wu (勇敢的螳螂) ★☆☆☆☆ -
盒子活跃会员
2022/8/6 16:42:33
标题:
如何将百万行记录的单表xlsx文件导入到2008里 浏览:1344
加入我的收藏
楼主: 我实现了用导入导出工具 导不进去 xlsx记录太多了
----------------------------------------------
-敢于学习,谦虚学习,鼓励批评!!
作者:
男 lordaeron (Terry) ★☆☆☆☆ -
禁用账号
2022/8/6 16:45:55
1楼: ……
被禁用帐号,帖子内容自动屏蔽!
……

----------------------------------------------
该账号是个傻逼
作者:
女 sinagirl (雪亮) ★☆☆☆☆ -
盒子活跃会员
2022/8/6 16:56:25
2楼: xlsx's limit more then 32,767
----------------------------------------------
健康快乐每一天
作者:
男 hz_2009 (盒子) ★☆☆☆☆ -
普通会员
2022/8/6 20:01:17
3楼: 转成用 | 间隔数据的文本文件,然后批量导入 SQL: 
BULK INSERT TableName FROM '文件名' WITH (FIELDTERMINATOR =' | ',ROWTERMINATOR = '\\n')

文件必须在数据库所在计算机上
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/8/6 21:02:09
4楼: NO, NO, NO... you DONT HAVE LIMITS (theorically) in your read/write
as a Database, you source-data can be a text-file, a Excell-file, a table
the limits it's your system-files/memory/etc...
--- of course, in some software like MS-Excell exists a limit by resource! Sorry <:(

NO, NO, NO... you DONT NEED CONVERT THE SOURCE-DATA TO TEXT!
you can use ODBC to read/write your data in original-source!

NO, NO, NO... the file can be in any place in your network!
if you need use a file in your internet, no problem, just use any "Server" to catch it... or you can use "Indy" components in your RAD Studio!

here my tip about IMPORT/EXPORT data to/from RAD Studio:

1) you can use the FireDAC framework for complete this task!
--- components FireDAC:
    FDBatchMove1: TFDBatchMove;
    FDBatchMoveTextReader1: TFDBatchMoveTextReader;
    FDBatchMoveTextWriter1: TFDBatchMoveTextWriter;
    FDBatchMoveDataSetReader1: TFDBatchMoveDataSetReader;
    FDBatchMoveDataSetWriter1: TFDBatchMoveDataSetWriter;
    FDBatchMoveSQLReader1: TFDBatchMoveSQLReader;
    FDBatchMoveSQLWriter1: TFDBatchMoveSQLWriter;
    FDBatchMoveJSONWriter1: TFDBatchMoveJSONWriter;

with this components and other from RAD Studio you can read/write data in basically any source/target in our software!

the Source/Target of data can be any one, Database, Text, Excell file, etc...
to Microsoft products, you can use ODBC to access it, for example!

then, to ODBC you can a:
-- FDBatchMoveDataSet READ/WRITE
-- FDBatchMoveSQL READ/WRITE
-- FDBatchMoveText READ/WRITE

to Export/Import just inform the class that you need:
--- read or write from Dataset --> FDBatchMoveDataSetXXXX / FDBatchMoveSQLXXXX
--- read or write from Text --> FDBatchMoveTextXXXX / FDBatchMoveJSONXXXX

at end, you can your your "FDBatchMove" to proced the action!!!

not needs create any workaround for this! 
all simples and pratice! No needs any third-party framework or component!
all it's ready for you!
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/8/6 21:22:25
5楼: you need bind the components property for all works!

my example WITHOUT any FDConnection or Database use:
--- CVS file to FDMemTable directly!
----------
components on screen:
    FDBatchMove1: TFDBatchMove;
    FDBatchMoveTextReader1: TFDBatchMoveTextReader;
    FDMemTable1: TFDMemTable;
    FDGUIxWaitCursor1: TFDGUIxWaitCursor;
    FDBatchMoveDataSetWriter1: TFDBatchMoveDataSetWriter;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    DBNavigator1: TDBNavigator;
    FDBatchMoveTextWriter1: TFDBatchMoveTextWriter;

    Memo1: TMemo;
    DBMemo1: TDBMemo;
    DBEdit1: TDBEdit;



var
  MyFDTextField: TFDTextField;
...
begin
  FDBatchMoveTextReader1.DataDef.Fields.Clear;
  FDBatchMoveTextWriter1.DataDef.Fields.Clear;

... defining TextRead ... to read a CVS file (text file)
  FDBatchMoveTextReader1.DataDef.EndOfLine      := TFDTextEndOfLine.elDefault; // ? Win,Linux
  FDBatchMoveTextReader1.DataDef.Delimiter      := '"';          // ?
  FDBatchMoveTextReader1.DataDef.RecordFormat   := rfCustom;          // ?
  FDBatchMoveTextReader1.DataDef.Separator      := ',';          // ?
  FDBatchMoveTextReader1.DataDef.WithFieldNames := true;
  // FDBatchMoveTextReader1.DataDef.FormatSettings...
  FDBatchMoveTextReader1.Encoding := TFDEncoding.ecANSI; // ?

... creating Fields definitions to reader
      MyFDTextField          := FDBatchMoveTextReader1.DataDef.Fields.Add;
      MyFDTextField.FieldName := MyItem;
      MyFDTextField.DataType  := TFDTextDataType.atString;
      MyFDTextField.FieldSize := MyFieldSize;
      //
      FDMemTable1.FieldDefs.Add(MyItem, TFieldType.ftString, MyFieldSize, false);

... the writer = reader definitions
  FDBatchMoveTextWriter1.DataDef := FDBatchMoveTextReader1.DataDef;

... to target a Dataset (FDMemtable) for example
  FDBatchMove1.Writer := FDBatchMoveDataSetWriter1;

... to target DB components on screen
  DBMemo1.DataField := 'field name'; // to show on screen for example
  DBEdit1.DataField := 'field name';
...
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/8/6 21:26:07
6楼: screenshot
此帖子包含附件:
PNG 图像
大小:22.9K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 xianguo (Encina) ★☆☆☆☆ -
盒子活跃会员
2022/8/7 9:41:43
7楼: FlexCel + UniDAC
此帖子包含附件:xianguo_20228794120.rar 大小:5.21M
----------------------------------------------
delphi吾爱
作者:
男 dorry (littlecat) ★☆☆☆☆ -
盒子活跃会员
2022/8/7 17:06:56
8楼: lazarus 下的例子,应该没有问题的!
----------------------------------------------
泱泱华夏十亿兵,国耻期待儿孙平,愿提十万虎狼旅,跃马扬刀灭东京!
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行101.5625毫秒 RSS