#include
#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 = "輸入的參數(shù)值";
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(sin.size()), BindInfo::In);
st.ExecutePrepared();
cout<< nout << sout <其中nout, :sout, :iin, :sin,分別代表存儲過程中int型的輸出,string型的輸出;int型的輸入和string型的輸入;
需注意要在projict 的最后一個工程屬性的C/C++和鏈接器的第一個常規(guī),分別加上include和lib庫。
附件:http://down.51cto.com/data/2365892
網站欄目:通過OCILIB連接oracle執(zhí)行存儲過程
文章網址:http://weahome.cn/article/jcdidd.html