pchome2000 发表于 2011-5-12 20:02:42

用au3将excel表导入到sql中去,会出错???

本帖最后由 pchome2000 于 2011-5-12 20:04 编辑

用au3将excel表导入到sql中去,这个语句不会出错
$Conn.Execute("select * into aa_temp from OpenDataSource('microsoft.jet.oledb.4.0','excel 8.0;hdr=yes;IMEX=1;Data Source=c:\123.xls')...")

将这个语句改成这样会出错,何解??

$Conn.Execute("select * into aa_temp from OpenDataSource('microsoft.jet.oledb.4.0','excel 8.0;hdr=yes;IMEX=1;Data Source=c:\aa\123.xls')...")

auto 发表于 2011-5-12 20:19:05

没见过这样用过,用什么样的数据库?
提供建表语句和XLS文件来试试看

the886 发表于 2011-5-12 21:17:27

错语提示什么?

pchome2000 发表于 2011-5-12 21:24:28

本帖最后由 pchome2000 于 2011-5-12 22:02 编辑

回复 2# auto
连接mssql数据库

Dim $sServer = '192.168.1.6', $sUsername = 'sa', $sPassword = '123456'
$Conn = ObjCreate("ADODB.Connection")
$Conn.open("DRIVER={SQL Server};SERVER=" & $sServer & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";")
If @error Then Exit

$Conn.Execute("use test")

用au3将excel表导入到sql中去,这个语句不会出错
$Conn.Execute("select * into aa_temp from OpenDataSource('microsoft.jet.oledb.4.0','excel 8.0;hdr=yes;IMEX=1;Data Source=c:\123.xls')...")

将这个语句改成这样会出错,何解??

$Conn.Execute("select * into aa_temp from OpenDataSource('microsoft.jet.oledb.4.0','excel 8.0;hdr=yes;IMEX=1;Data Source=c:\aa\123.xls')...")

excel文件见附件

m765555 发表于 2011-5-13 08:32:00

正在学习SQL,有空再研究一下

nxbigdaddy 发表于 2011-5-13 08:56:16

下来看看到底是怎么一回事。。。

auto 发表于 2011-5-13 13:26:41

没有MSSQL,换成ACCESS报错测试,两个语句都报错

kk_lee69 发表于 2011-5-14 01:23:47

你的 123.XLS 位置是放在 AA 底下嗎??
页: [1]
查看完整版本: 用au3将excel表导入到sql中去,会出错???