请高手帮忙看看excel导入sql数据库的问题给分100
Private Sub Command2_Click()
CommonDialog1.FileName = ""
CommonDialog1.Flags = 4096
CommonDialog1.Filter = "(*.xls)"
CommonDialog1.FilterIndex = 3
CommonDialog1.DialogTitle = "Open File(*.xls)"
CommonDialog1.Action = 1
If CommonDialog1.FileName = "" Then
MsgBox "no file selectd", 37, "checking"
Else
Dim Cn As ADODB.Connection
Dim strSQL As String
Dim lngRecsAff As Long
Set Cn = New ADODB.Connection
Cn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=xskf;Data Source=."
strSQL = "INSERT INTO 成品 select " & "姓名,性别 FROM " & "OPENROWSET('Microsoft.Jet.OLEDB.4.0'," & "'Excel 8.0;Database=" & CommonDialog1.FileName & "',Sheet1$)"
Debug.Print strSQL
Cn.Execute strSQL, lngRecsAff, adExecuteNoRecords
Debug.Print "Records affected: " & lngRecsAff
MsgBox "本次共导入" & lngRecsAff & "条记录!"
Cn.Close
Set Cn = Nothing
End If
这是将excel导入sql数据库,大家帮忙看看这段代码有什么错误的地方,在运行的时候'Microsoft.Jet.OLEDB.4.0'返回一个错误提示:找不到可安装的ISAM
怎么改呢