Home > database >  To get the help, night, consult OpenRowSet function
To get the help, night, consult OpenRowSet function

Time:10-01

Select * Into teststudent2 from OpenRowSet (' Microsoft. Jet. The OLEDB. 4.0 ', 'Excel 8.0; HDR=Yes; The DataBase=F: \ ZGC \ PB \ test \ copyexceltosql \ student XLS ', 'select * from [sheet1 $]')
In query analyzer can pass, but in the PB application to submit this line not line, why??????
PB does not support this function?
Please prawns advice, the younger brother grateful!

CodePudding user response:

Online, etc., please help,

CodePudding user response:

Used on

Through the odbc way?

CodePudding user response:

PB you must first build connection!

CodePudding user response:

PB also does not have this function!

CodePudding user response:

Use the SQLCA perform other statements is normal, but it is wrong,

CodePudding user response:

Find the problem, damn it,
When performing this statement will be the AutoCommit mode is set to True
It's as simple as that,

CodePudding user response:

Find the problem, damn it,
When performing this statement will be the AutoCommit mode is set to True
It's as simple as that,

CodePudding user response:

Then rub some points, remember next time error to the sqlca. Sqlerrtext posted

CodePudding user response:

The EXCEL or use ODBC
The transaction access
Access=CREATE transaction
Access. DBMS='ODB'
Access. DBParm="ConnectString='Driver={Microsoft Excel Driver (*. XLS)}; Dbq="+ name +"; Uid=; The Pwd='
"CONNECT USING the access;
IF the access. SQLCode & lt;> 0 THEN
M_errmsg=access. SQLErrText
The Return - 1
END the IF
Atr_cnn=access
So you can directly extract

CodePudding user response:

The
refer to the original poster Dorami123 posts:
select * Into teststudent2 from OpenRowSet (' Microsoft. Jet. The OLEDB. 4.0 ', 'Excel 8.0; HDR=Yes; The DataBase=F: \ ZGC \ PB \ test \ copyexceltosql \ student XLS ', 'select * from [sheet1 $]')
In query analyzer can pass, but in the PB application to submit this line not line, why??????
PB does not support this function?
Please prawns advice, the younger brother grateful!


Also note that the file path refers to the path on the database server is not a local path!

CodePudding user response:

Don't understand the meaning

CodePudding user response:

Try this write
String ls_sql

Ls_sql="select * Into teststudent2 from OpenRowSet (' Microsoft. Jet. The OLEDB. 4.0 ', 'Excel 8.0; HDR=Yes; The DataBase=F: \ ZGC \ PB \ test \ copyexceltosql \ student XLS ', 'select * from [sheet1 $]') "

The execute immediate: ls_sql using sqlca;

CodePudding user response:

Oh!!!!!
The original has been done!!

CodePudding user response:

Done on the check.