My goal is to make a excel file into the SQL database "SBGL" on the table in the "equipment" in table 1
'set connection SQL database connection string
Strtemp="[odbc Driver={SQL Server}; Server=(local); the Database=SBGL]"
'set the Excel data connection
Strconn="Provider=Microsoft. Jet. The OLEDB. 4.0. Data Source=Data list. XLS; Extended Properties=Excel; HDR=No. IMEX=1
"Cn. Open strconn
STRSQL="insert into equipment total the select * from table 1/equipment list. XLS"
Cn. The Execute STRSQL
When debugging shows "could not find the ISAM can be installed"
Supplementary information:
1, the data list. XLS this file in a program with a directory
2, VB reference excel11
I think it's string has a problem, but can't see what the problem is,
Extended Properties=there is something wrong with the Excel version didn't write back?
CodePudding user response:
Data Source=behind it is best to complete pathname, the current path is may change, may not have been the program with a directory,Excel SQL, the "table" is the name of the worksheet, should be similar to Sheet1, Sheet2, your "table" is what?
CodePudding user response:
1, the problem of the connection stringExtended Properties='Excel 8.0; HDR=NO. IMEX=1 '
//HDR said to the first line as the data or as column names, as the data using HDR=no, as the column name with HDR=yes; Hybrid via Imex=1 to read the text type, avoid null values,
On the other two single quotes around cannot little,
2, just register Excel ISAM can
In the "run" dialog box input a carriage return: Regsvr32 c: \ WINDOWS \ system32 \ msexcl40 DLL
CodePudding user response:
This should be the 2003 version, or to see your machine excel versionIf not, you can install the full version of excel and try it, I suppose you are the office of the unity of the lite version of a few.