各位大虾:
你们好,我现在很急,公司有很多excel文件里面有很多数据,我想通过
前端delphi程序来读取,然后保存到数据库后台,不知道有什么办法?请各位大师
救救我!
你们好,我现在很急,公司有很多excel文件里面有很多数据,我想通过
前端delphi程序来读取,然后保存到数据库后台,不知道有什么办法?请各位大师
救救我!
解决方案 »
- delphi中显示数据库记录用哪个控件速度快并且好用?是dbgrid吗?
- 一个三层架构的问题!在线等待急....
- 计算机中了几个奇怪的病毒大家帮帮我
- ExpressPrinting System控件里变量没定义?
- 高手指点:多步操作产生错误。请检查每一步的状态值
- 这样的批量录入用什么控件比较好!
- 请进来看看,从BCB翻译过来的代码,为什么就不能运行?在线等
- 我靠,庆祝一下,上个月我得专家分Delphi版排名第二,大家来捧场呀,祝福我吧 !!!
- 关于QUICKREPORT的多表查询的明细打印
- 高分求助:如何使用word和hcw制作帮助
- 一个简单的有关表的更新问题
- 用NMSMTP做MAIL时,怎样根据邮箱名得到它的SMTP服务器名称啊?欢迎光临!!
在Google里搜索《葵花宝典》,是delphi的帮助工具。很好用的。同时,也给你一个小例子吧。 var
bm: TBook;
col, row: Integer;
sline: String;
mem: TMemo;
ExcelApp: Variant;
begin
Screen.Cursor := crHourglass;
DBGrid1.DataSource.DataSet.DisableControls;
bm := DBGrid1.DataSource.DataSet.GetBook;
DBGrid1.DataSource.DataSet.First;
// create the Excel object
if toExcel then
begin
ExcelApp := CreateOleObject('Excel.Application');
ExcelApp.WorkBooks.Add(xlWBatWorkSheet);
ExcelApp.WorkBooks[1].WorkSheets[1].Name := 'Grid Data';
end;
// First we send the data to a memo
// works faster than doing it directly to Excel
mem := TMemo.Create(Self);
mem.Visible := false;
mem.Parent := MainForm;
mem.Clear;
sline := '';
// add the info for the column names
for col := 0 to DBGrid1.FieldCount-1 do
sline := sline + DBGrid1.Fields[col].DisplayLabel + #9;
mem.Lines.Add(sline);
// get the data into the memo
for row := 0 to DBGrid1.DataSource.DataSet.RecordCount-1 do
begin
sline := '';
for col := 0 to DBGrid1.FieldCount-1 do
sline := sline + DBGrid1.Fields[col].AsString + #9;
mem.Lines.Add(sline);
DBGrid1.DataSource.DataSet.Next;
end;
// we copy the data to the clipboard
mem.SelectAll;
mem.CopyToClipboard;
// if needed, send it to Excel
// if not, we already have it in the clipboard
if toExcel then
begin
ExcelApp.Workbooks[1].WorkSheets['Grid Data'].Paste;
ExcelApp.Visible := true;
end;
不知道还笑别人,去搜吧,肯定对你有帮助的!!
我是通過delphi程序來讀取excel文件中的數據呀,而不是通過delphi把數據導出到
excel中去。至於《葵花宝典》我去查查