Hi All!
Have anyone ever import data from Excel to SQL Server using ado?
Here is the code that gives me an error: [OLE/DB Provider returned message: Unspecified error]
Dim lngRecsAff As Long
Dim strSQL As StringSet
Conn = New ADODB.Connection
Conn.Open DbConnection()
strSQL = "Select * INTO Purchaser FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Data Source=C:\book.xlsx','SELECT * FROM [Sheet1$]')"
Conn.Execute strSQL, lngRecsAff, adExecuteNoRecords
What is missing here?
Have anyone ever import data from Excel to SQL Server using ado?
Here is the code that gives me an error: [OLE/DB Provider returned message: Unspecified error]
Dim lngRecsAff As Long
Dim strSQL As StringSet
Conn = New ADODB.Connection
Conn.Open DbConnection()
strSQL = "Select * INTO Purchaser FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Data Source=C:\book.xlsx','SELECT * FROM [Sheet1$]')"
Conn.Execute strSQL, lngRecsAff, adExecuteNoRecords
What is missing here?