RT
解决方案 »
- delphi 的 button文字运行时鼠标经过文字会变化是怎么回事?
- 工作效率问题
- Delphi中,如何从一个数据源控件(TDataSource)中获取该数据源的DataSet属性中的ConnectionString属性的内容或者是Connnection属性的内
- 超长SQL语句执行(SQL脚本)
- http://www.17delphi.org
- 数据库及报表问题,请大家帮我一下
- 求救!!!‘Cannot assign a TMetafile to a TPicture’
- 请问如何将代码和控件全部拷贝?
- tikkypeng(千两狂死郎)和lovewangj(lllll)
- 为什么还是不行!
- 用access和delphi的dbimage实现毕业生相片的存取!!???100分
- 急!来者给分!
比较烦。
我觉得还是用OLE比较好,但是我一直都想知道怎么样做。
望高人指点一下。
var XlsFile,XlsSheet:variant;
sheetname,excel_name,prf_flag:string;
i,j:integer;
model_name:string;
begin
try
try
if VarisEmpty(XlsFile) then
XlsFile:=CreateoleObject('Excel.Application');
XlsFile.Workbooks.Add(trim(file_name));
XlsSheet:=XlsFile.WorkSheets[trim(ed_sheet1.Text)];////////////////////////////////////////////////////////////////////////
for i:=9 to strtoint(ed_count.Text) do
begin
prf_flag:=XlsSheet.cells[i,5];
/////////////////////
if prf_flag='PRF' then //prf import
begin
model_name:=model_hhpn(trim(XlsSheet.cells[i,3]));
if Aset_prf.Locate('CUSTOMERPARTNO',model_name,[loCaseInsensitive]) then
begin
Aset_prf.Edit;
for j:=0 to listbox_col.Items.Count-1 do
begin
Aset_prf.Fields[j+1].AsInteger:=Aset_prf.Fields[j+1].AsInteger+strtoint(XlsSheet.cells[i,week_index(listbox_col.Items.Strings[j])]);
end;
Aset_prf.Post;
end
else
////------------------------------------////////////
begin
Aset_prf.Insert;
Aset_prf.Fields[0].AsString:=model_name;
for j:=0 to listbox_col.Items.Count-1 do
begin
Aset_prf.Fields[j+1].AsInteger:=strtoint(XlsSheet.cells[i,week_index(listbox_col.Items.Strings[j])]);
end;
Aset_prf.post;
end;
/////----------------------------------------////////////// end;
//--------------------------------------------------------------//
{ else
if prf_flag='Current/RTF' then //////////////rtf import
//----------------------------------------------//
begin
if Aset_rtf.Locate('CUSTOMERPARTNO',model_hhpn(XlsSheet.cells[i-1,3]),[loCaseInsensitive]) then
begin
Aset_rtf.Edit;
Aset_rtf.Fields[1].AsInteger:=Aset_rtf.Fields[1].AsInteger+strtoint(XlsSheet.cells[i,11]);
Aset_rtf.Post;
end
else
begin
Aset_rtf.Insert;
Aset_rtf.Fields[0].AsString:=model_hhpn(XlsSheet.cells[i-1,3]);
Aset_rtf.Fields[1].AsInteger:=strtoint(XlsSheet.cells[i,11]);
Aset_rtf.Post;
end;
end;}
//---------------------------------------//
ProgressBar1.StepBy(1);
//////////////////////
end;
///////////////////////////////////////////////////////////////////////////////
except
begin
SHOWMESSAGE('PRF SHEET 名文檔可能不為 PRF !');
raise;
end;
end;
finally
begin
XlsFile.quit;
XlsFile:=null;
end;
end; // try finally end
end;
1。Extended Properties-------Excel8.0
2。ADOQuery 中的SQL
3。生成的EXE关闭DELPHI调试的程序后运行。源程序中有动态实现方法,不知是否你想要的。EMAIL你。
连上后,按其他与数据库表的操作相同。
付送:微打命令集.xls
谁要??????? [email protected]