摘要: unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls,jpeg;typeTForm1 = class(TForm)Button1: TButton;Memo1: TMemo;procedure Button1Click(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm1: TForm1;imp 阅读全文
posted @ 2012-09-27 17:20 马儿快跑 阅读(520) 评论(0) 推荐(0) 编辑
摘要: 两种方法,一是用ADO连接,问题是Excel文件内容要规则,二是用OLE打开,但操作就没有象操作数据库那么方便了.一、用ADO连接:设置属性ConnetionString 选择 Microsoft Jet 4.0 OLE DB provider Select or enter a datasorce name -> 选择你要打开Excel文件 User name默认是Admin 密码默认为空,可以不用理会 Extended properties 设为:Excel 8.0 sql语句 select * from [yourtablename] (注意要有[]) 二、用OLE打开(以下是一个 阅读全文
posted @ 2012-09-27 16:25 马儿快跑 阅读(20654) 评论(1) 推荐(0) 编辑
摘要: 前几天问过这个问题,很多朋友给了我回答。本以为解决了。但现在新问题又来了。 代码如下: ... ExcelApp,workbook: Variant; ... ExcelApp:=CreateOleObject( 'Excel.Application '); workbook:=CreateOleObject( 'Excel.sheet '); 上次大家给我的代码是: workbook.close; ExcelApp.quit; workbook:=unassigned; excelapp:=unassigned; 这些代码放在窗口的onclose方法里没问题, 阅读全文
posted @ 2012-09-27 16:08 马儿快跑 阅读(4501) 评论(0) 推荐(0) 编辑