ASP和MS-Access数据库 - 如何从XLS文件导入数据
问题描述:
我想允许用户上传xls文件9列和行的数量不受限制。
我会跑过来everyline和数据插入到数据库
i want to allow the user to upload xls file with 9 columns and unlimited number of rows. i will run over everyline and insert the data to the db
我如何读取XLS文件?
how do i read the xls file?
答
使用SQL语句来更新从Excel访问的例子。
Example of using an SQL statement to update Access from Excel.
Set cn = CreateObject("ADODB.Connection")
scn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\docs\dbto.mdb"
cn.Open scn
sSQL = "SELECT * INTO NewTable FROM "
sSQL = sSQL & "[Excel 8.0;HDR=YES;IMEX=2;DATABASE=C:\Docs\From.xls].[Sheet1$]"
cn.Execute sSQL, recs
MsgBox recs