otl 使用

// TODO: 在此处引用程序需要的其他头文件
#define OTL_ODBC 
//OTL连接方式为ODBC
#define OTL_STREAM_READ_ITERATOR_ON 
//使用OTL迭代器
#define OTL_STL 
//OTL使用标准库#include "otlv4.h"
otl_connect db; 
// connect objectotl_connect::otl_initialize(); 
// initialize the database API environment
try
{ 
	std::string str ="DSN=dbsource; UID=sa; PWD=800100;";
	db.rlogon(str.c_str(),1);
	// connect to the database API std::string 
	_sql = "{call CTI_GetATaskItem(:TaskID,:ItemID,:TelNum)}";
	otl_stream os(1,_sql.c_str(),db); os << 13; int tt = -1;
 	char nn[50]= {0}; 
	os >> tt >> nn; 
	cout << tt << "," << nn; 
} 
catch(otl_exception& p)
{ 
	// intercept OTL exceptions cerr<<p.code<<endl;
 	// print out error code cerr<<p.msg<<endl; 
	// print out error message cerr<<p.stm_text<<endl; 
	// print out SQL that caused the error cerr<<p.var_info<<endl;
 	// print out the variable that caused the error 
} 
db.logoff(); 
// disconnect from the database

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值