A simple statement:
Insert openrowset (' sqloledb ', 'Server Name'; 'username'; "Password", databasename. Dbo. Tablename)
Select * from tb_tablename
In the query analyzer can run successfully,
But in PB11.5:
String ls_sql
Ls_sql="insert openrowset" & amp;
+ "(' sqloledb ', 'Server Name'; 'username; "Password", databasename. Dbo. Tablename) "& amp;
+ "select * from tb_tablename"
The execute immediate: ls_sql using sqlca;
This executive complains: when I was a new transaction cannot register to specify the transaction manager,
The most strange is:
Ls_sql="delete from openrowset" & amp;
+ "(' sqloledb ', 'Server Name'; 'username; "Password", databasename. Dbo. Tablename) "& amp;
+ "where id not in (select id from tablename)"
The execute immediate: ls_sql using gta_server;
So can the normal execution,
Really wonder, why can delete code execution, and insert the code cannot perform, please teach greatly,
CodePudding user response:
You get rid of single quotation marks inside to see?CodePudding user response:
Before executing the autocommit mode is set to truethe sqlca. The autocommit=true
String ls_sql
Ls_sql="insert openrowset" & amp;
+ "(' sqloledb ', 'Server Name'; 'username; "Password", databasename. Dbo. Tablename) "& amp;
+ "select * from tb_tablename"
The execute immediate: ls_sql using sqlca;
the sqlca. The autocommit=false
CodePudding user response:
Why is the semicolon between the field name?In addition the delete statement is can not specify the field name,
CodePudding user response:
Problem solved, thank you,