#include <iostream> #include "ocilib.hpp" using namespace std; using namespace ocilib; #pragma comment(lib,"ociliba.lib") #pragma comment(lib,"ocilibw.lib") int main() { try { int ncout = 0, iin = 11; string sout,sin = "输入的参数值"; Environment::Initialize(); Connection con("server", "id", "password"); Statement st(con); st.Prepare("begin 存储过程名(:nout, :sout, :iin, :sin); end;"); st.Bind(OTEXT(":nout"), nout, BindInfo::Out); st.Bind(OTEXT(":sout"), sout, 256, BindInfo::Out); st.Bind(OTEXT(":iin"), iin, BindInfo::In); st.Bind(OTEXT(":sin"), sin, static_cast<unsigned int>(sin.size()), BindInfo::In); st.ExecutePrepared(); cout<< nout << sout <<endl; } catch (std::exception &ex) { } Environment::Cleanup(); return 0; }
其中nout, :sout, :iin, :sin,分别代表存储过程中int型的输出,string型的输出;int型的输入和string型的输入; 需注意要在projict 的最后一个工程属性的C/C++和链接器的第一个常规,分别加上include和lib库。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。