看看,或许你能解决
前面执行一段 存储过程
sqlca.autocommit = true
//附加主DB到数据库当中
string dynamic_sql
string ls_use
ls_use = 'EXEC'+'('+"'USE master'"+')'
EXECUTE IMMEDIATE :ls_use ;
dynamic_sql = "EXEC sp_attach_db @dbname = '"+ls_account_code+"',@filename1 ='" + l_to +"',@filename2 ='" + l_to_log +"'"
execute IMMEDIATE :dynamic_sql;
g_tr_main.autocommit = false
//messagebox("",string(g_tr_main.sqlerrtext))
if g_tr_main.sqlcode >= 0 then
messagebox("提示","数据库生成成功!")
end if
前面的存储过程如果执行后close,下面的execute IMMEDIATE :dynamic_sql;
出现错误信息: the procedure could not be execute or the resuts is not exits
如果把上面的close去掉,数据库也没有附加过去,我把 dynamic_sql抄下来放到
查询分析器执行却可以。请各位多指教。
为什么