乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > -delphi access excel,delphi excel

-delphi access excel,delphi excel

作者:乔山办公网日期:

返回目录:excel表格制作







var sTableName : String;begin //1.用adoconnection组件链接excel,其中E_file.text中的内容是通过opendialog1.filename获得的excel文件路径 ADOcn.Close;
ADOcn.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' +
Trim(E_File.Text)+';Extended Properties=Excel 8.0;Persist Security Info=False';
ADOcn.Open;
ADOCn.Connected := true; //2.adocn要和adoquery1要先链接好,然后将excel数据读出来并存储在数据集中(adoquery1), sTableName := 'Sheet1';//excel工作表的名称 adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add('SELECT * FROM ['+sTableName +'$]'); adoquery1.open; adoquery1.first; while not adoquery1.eof do begin //3.向目标数据库中插入数据(用adoquery2来实现插入操作) //adoquery2要保证通过adoconnection组件和access数据做好链接adoquery2.Connection属性要设置 成和access链接好的adoconnetion组件。 ADOCn.BeginTrans;//开始事务 try adoquery2.close; adoquery2.sql.clear; //aaa为access中的表名,a,b,c,d,e,f,g,h,i为access表的字段7a64e59b9ee7ad94366名 adoquery2.sql.add('INSERT INTO aaa (a,b,c,d,e,f,g,h,i) VALUES ('''+adoquery1.FieldByName('a1').asstring+''','''+adoquery1.FieldByName('a2').asstring+''','''+adoquery1.FieldByName('a3').asstring+''','''+昨日收盘列需要插入的数据内容写在这里+''')'); //上面的sql语句中出现的'''++'''表示插入的是字符串类型,如果是数值类型就写成'++' adoquery2.ExecSQL; ADOCn.CommitTrans;//提交事务 except ADOCn.RollbackTrans;//回滚事务 end; adoquery1.next; end;end;

相关阅读

  • -delphi access excel,delphi excel

  • 乔山办公网excel表格制作
  • var sTableName : String;begin //1.用adoconnection组件链接excel,其中E_file.text中的内容是通过opendialog1.filename获得的excel文件路径 ADOcn.Close; ADOcn.ConnectionSt
  • <em>Delphi</em> CreateOLEObject使用<em>Excel

  • 乔山办公网excel表格制作
  • 对 Excel 操作有多种,如果要显示 excel 的界面,进行与用户的交互,可以使用 OleContainer 组件。可以 delphi 自带的 office 控件,进行excel 操作,这种方法的zhidao缺点在于,只能支持特定的版
  • <em>delphi</em> 如何写入<em>Excel</em>-d

  • 乔山办公网excel表格制作
  • 这个太简单了,我有,给我发消息,给我你的邮箱地址delphi中SaveDialog用把stringGrid..." src="/uploads/tu/675.jpg" style="width: 400px; height: 267px;" />在开发数据库应用程序中,经常要将类型相同的数
关键词不能为空

ppt怎么做_excel表格制作_office365_word文档_365办公网