- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
从excel导入数据(Import data from Excel)
从excel导入数据(Import data from Excel)
/ / 導入exceltosql
Var.
SQL: string;
Begin
Adoquery1.close; / / adoquery1? 接sqlserver的connection
Adoquery1.sql.clear; / / 清空sql
SQL: = insert into tbl1 (ID, name, sex, pH, adat) select id, name, sex, pH, adat from openrowset (microsoft.jet.oledb.4.0, excel 5.0; HDR = yes; database = D: \ d.xls, Sheet1 $); / / $要求的excel表格 Sheet1
Adoquery1.sql.add (SQL); / /? 行sql
Adoquery1.execsql;
End;
-----------------------------------------------
不要用excelapplication来导入数据, 这样当然慢了, 直接用ado来导入, ado本身就支持execl的.以下是ado组件的connectionstring的连接字符串
Provider = microsoft.jet.oledb.4.0; user id = admin; data source = D: \ \ \ \ 2001年11月在职职工98封定工资.xls 我的文档 人事资料 在职; mode = share deny none; extended properties = excel 8.0;
把其中的 data source = D: \ \ \ \ 2001年11月在职职工98封定工资.xls 我的文档 人事资料 在职 改成你的execl文件, 就可以直接用adotable或adoquery来打开处理了.这样的效率将是你原来方法的n倍!
Top
----------------------------------------------
Delphi与excel的亲密接触 作者: 王安鹏 发布时间: 2002 / 04 / 22
文章摘要:
Delphi作为一个出色的rad, 强大的数据库功能是其最重要的特色之一, 但是操纵困难的quickreport控件常常不能满足数据库报表的需要.如果你的报表非常复杂, 或者要求灵活地改变格式, 那么使用excel作为报表服务器是一个不错的选择.delphi从版本5开始提供的excel组件极大地简化了ole自动化技术的应用.
Unit Unit1;
The interface
Use
Windows, messages, SysUtils, variants, classes, graphics, controls, forms,
Dialogs, stdctrls;
Type
TForm1 = class (tform)
Button1: tbutton;
Procedure button1click (sender: tobject);
Private
Private declarations} {
Public
{public declarations}
End;
Var.
Form1: TForm1;
Implementation
Use comobj;
{$R * DFM}
Procedure tform1.button1click (sender: tobject);
Var.
I: integer;
Excel _ handle: olevariant;
Begin
Try
excel_handle:= getactiveoleobject(excel。应用”);
除了
尝试
excel_handle:= createoleobject(excel。应用”);
除了
出口;
结束;
结束;
/ /被(IntToStr(excel_handle。表。计数));
我:= 1 excel_handle.sheets.count做
被(excel_handle。表[我]的名字);
结束;
结束。
------------------------------------------------------
正文:
Delphi与Excel的亲密接触
Delphi作为一个出色的rad,强大的数据库功能是其最重要的特色之一,但是操纵困难的QuickReport控件常常不能满足数据库报表的需要。如果你的报表非常复杂,或者要求灵活地改变格式,那么使用Excel作为报表服务器是一个不错的选择。Delphi从版本5开始提供的Excel组件极大地
您可能关注的文档
- 北语13春《中外文化交流史》作业1(No. 13 spring the history of cultural exchange between China and foreign countries homework 1).doc
- 北语网院13春《商法》作业1(BLCU academy 13 spring commercial homework 1).doc
- 北语网院13春《商法》作业2(BLCU academy 13 spring commercial homework 2).doc
- 北语网院13春《商法》作业4(BLCU academy 13 spring commercial homework 4).doc
- 北语网院13春《国际商法》作业2(BLCU of spring 13 International Business Law homework 2).doc
- 北语网院13春《国际商法》作业1(BLCU of spring 13 International Business Law homework 1).doc
- 北语网院13春《国际商法》作业3(BLCU of spring 13 International Business Law homework 3).doc
- 北语网院13春《国际商法》作业4(BLCU of spring 13 International Business Law homework 4).doc
- 北语网院13春《市场营销学》作业1(BLCU academy 13 spring marketing homework 1).doc
- 北语网院13春《民间文学》作业1(BLCU academy 13 spring Folk Literature homework 1).doc
- 从pcs 7 v7.0开始,如何计算as和os授权的po个数(Starting with PCS 7 v7.0, how do you calculate the number of as po and OS authorization).doc
- 从pk到vs看英文化(From PK to VS to see English culture).doc
- 从“短、平、快”到“高、精、尖”.doc
- 产品五维选择法(Product five dimensional selection method).doc
- 从《汉译世界学术名著丛书》的出版谈翻译(On translation from the publication of the famous academic books translated from Chinese into the world).doc
- 从《赵氏孤儿》与《忠臣藏》看中日传统家制度(From the orphan and chushingura in Chinese and Japanese traditional family system).doc
- 产品对比(Product comparison).doc
- 产品—市场战略的拓展分析(Expansion analysis of product market strategy).doc
- 从世纪水战看新闻营销策略(Read the news from the war century marketing strategy).doc
- 从企业战略的角度分析三鹿集团的破产原因(Analysis of the bankruptcy reasons of Sanlu Group from the angle of enterprise strategy).doc
文档评论(0)