先加入ExcelApplication1;ExcelWorkbook1;ExcelWorksheet1;
procedure TForm1.n1Click(Sender: TObject);
var
row,brea:integer;
a,b,c,d,e:shortstring;
begin
if table1.active = True then begin
try
ExcelApplication1.Connect;
Except
ExcelApplication1.free;
Abort;
end;
brea := strtoint(inputbox('输入需导入行数!','行数','10'));
if brea<1 then brea := 10;
ProgressBar1.Visible := True;
ProgressBar1.Max := brea;
ExcelApplication1.Visible[0] := true;
for row := 2 to brea do
begin
a := ExcelWorksheet1.Cells.Item[row,2];
b := ExcelWorksheet1.Cells.Item[row,1];
c := ExcelWorksheet1.Cells.Item[row,3];
d := ExcelWorksheet1.Cells.Item[row,4];
e := ExcelWorksheet1.Cells.Item[row,5];
form1.show;
table1.AppendRecord([a,b,c,d,e]);
ProgressBar1.Position := row-1;
end;
ProgressBar1.Hide;
end;
end;
procedure TForm1.n1Click(Sender: TObject);
var
row,brea:integer;
a,b,c,d,e:shortstring;
begin
if table1.active = True then begin
try
ExcelApplication1.Connect;
Except
ExcelApplication1.free;
Abort;
end;
brea := strtoint(inputbox('输入需导入行数!','行数','10'));
if brea<1 then brea := 10;
ProgressBar1.Visible := True;
ProgressBar1.Max := brea;
ExcelApplication1.Visible[0] := true;
for row := 2 to brea do
begin
a := ExcelWorksheet1.Cells.Item[row,2];
b := ExcelWorksheet1.Cells.Item[row,1];
c := ExcelWorksheet1.Cells.Item[row,3];
d := ExcelWorksheet1.Cells.Item[row,4];
e := ExcelWorksheet1.Cells.Item[row,5];
form1.show;
table1.AppendRecord([a,b,c,d,e]);
ProgressBar1.Position := row-1;
end;
ProgressBar1.Hide;
end;
end;
解决方案 »
- Delphi 怎么样填表?
- 有关<中国游戏开发>的潜力有多大,游戏开发人才需求大吗?
- 关于自定义消息
- #######Socket的Time_Wait问题,帮顶有分,路过有分,解决了另开贴送分,:)######
- 紧急求救! FastReport 3.10 输出为PDF格式问题!
- 用过Smartscan XPress的同志来帮忙啊
- 在Delphi中如何将一个Word文档转换成一个PDF文档
- 什么是WINDOWS原子表,如何用它实现同一时刻只运行一个例程?
- 请问各位大虾,dxdbgrid怎样读取每一组的统计值,非常紧急,在线等!!!
- 廉价的小问题:看看不妨!
- Delphi
- 只有.dcu文件,没有其对应的.pas文件,能否放进工程中编译?怎样做?
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=路径\a.xls;Extended Properties=Excel 8.0;Persist Security Info=False';
ADODataSet1.CommandText:=$sheet1;ADODataSet2.Open;再用一个 ADOQuery1 一个数据一个数据地写入数据库
我连了,系统说from 子句语法错误!