string name,ls_sql,code
dec ld_value
code= "1"
ls_sql= "select sum(a.value) from ttt a"
DECLARE c1 DYNAMIC CURSOR FOR SQLSA;
PREPARE SQLSA FROM :ls_sql;
OPEN DYNAMIC c1 USING :code;
FETCH c1 INTO :ld_value;
If SQLCA.SQLCode=0 then //如果成功取出记录
messagebox('',string(ld_value))
end if
CLOSE c1;
怎么执行后没有返回值,请大家帮忙看看!!!
------解决方案--------------------
select sum(a.value) from ttt a
有没有值?
------解决方案--------------------
试试这个:
- SQL code
string ls_sql dec ld_value ls_sql= "select sum(a.value) from ttt a" DECLARE c1 DYNAMIC CURSOR FOR SQLSA; PREPARE SQLSA FROM :ls_sql; FETCH c1 INTO :ld_value; If SQLCA.SQLCode=0 then //如果成功取出记录 messagebox('',string(ld_value))end if CLOSE c1;
------解决方案--------------------
------解决方案--------------------
- C/C++ code
string name,ls_sql,code dec ld_valuecode= "1" ls_sql= "select sum(a.value) from ttt a where code = ?" DECLARE c1 DYNAMIC CURSOR FOR SQLSA; PREPARE SQLSA FROM :ls_sql; OPEN DYNAMIC c1 USING :code; FETCH c1 INTO :ld_value; If SQLCA.SQLCode=0 then //如果成功取出记录 messagebox('',string(ld_value))end if CLOSE c1;