Home > database >  Connection of pb and access
Connection of pb and access

Time:09-27

I am in the heart of the application of ODBC and access has been configured, the event in the SQLCA. The AutoCommit=true, the SQLCA. Sqlcode=0, then execute SSQL="SELECT Count (*) into: Qty FROM MSysObjects WHERE MSysObjects. Name like: strname;" , the EXECUTE IMMEDIATE: SSQL using sqlca; , the sqlca. Sqlcode=1, error messages, read permissions on the MSysObjects, is this why? Be urgent!!!!

CodePudding user response:

SSQL="SELECT Count (*) into: Qty FROM MSysObjects WHERE MSysObjects. Name like: strname;" ,
The EXECUTE IMMEDIATE: SSQL using sqlca;
SQL statement variables written assignment where there is a problem, you can debug to see if the assignment is normal,

CodePudding user response:

I wrote before, if you have into the whole sentence in the string is not appropriate, the other "... The Name like: strname;" Is wrong, how to give strname assignment?) .
The EXECUTE IMMEDIATE: SSQL using sqlca;
messagebox (" ', SSQL) -- in the SQL access can perform?
Method:
Write directly SELECT Count (*) into: Qty FROM MSysObjects WHERE MSysObjects. Name like: strname using the sqlca.

Is not welcome to point out mistakes.

CodePudding user response:

LZ need clear embedded SQL and the use of the dynamic SQL difference,,,

CodePudding user response:

Embedded SQL to support direct value to a variable that is similar to:
The select field into variables from table where conditions using the sqlca.

This will use dynamic SQL syntax, for example you

Long an rn
String ls_sql

//organization SQL syntax
Ls_sql="select count (number) automatically from data center where claim status='test' and (isnull (unit, ' ') not in (' inner ', 'mat')) and (1=1)"

//execute SQL syntax
Prepare sqlsa from: ls_sql;
The describe sqlsa into sqlda;
Declare myprc dynamic procedure for sqlsa;
The execute dynamic myprc using descriptor sqlda;
The fetch myprc using descriptor sqlda;
The close myprc;

//remove the results
Rn=getdynamicnumber (sqlda, 1)
If isnull (rn) then rn=0

Return an rn
  • Related