张智霖袁咏仪唱歌视频:SQLAPI 在VS2008里面如何使用?

来源:百度文库 编辑:中财网 时间:2024/04/30 11:08:10
我想用SQLAPI++ 对我的MYSQL数据库进行连接,可在用官方网站的example时候都出现问题,编译的时候没报错

可运行的时候,提示说没找到SQLAPI.DLL,请用过的赐招,要怎样去配置到SQLAPI++到开发环境VS20008中使用

下面我给出example代码

#include // for printf
#include // main SQLAPI++ header

int main(int argc, char* argv[])
{
SAConnection con; // create connection object

try
{
// connect to database
// in this example it is Oracle,
// but can also be Sybase, Informix, DB2
// SQLServer, InterBase, SQLBase and ODBC
con.Connect(
"test", // database name
"root", // user name
"13542024187", // password
SA_Oracle_Client);

printf("We are connected!\n");

// Disconnect is optional
// autodisconnect will ocur in destructor if needed
con.Disconnect();

printf("We are disconnected!\n");
}
catch(SAException &x)
{
// SAConnection::Rollback()
// can also throw an exception
// (if a network error for example),
// we will be ready
try
{
// on error rollback changes
con.Rollback();
}
catch(SAException &)
{
}
// print error message
printf("%s\n", (const char*)x.ErrText());
}

return 0;
}

先谢谢大家了!!!
  • 对我有用[0]
  • 丢个板砖[0]
  • 引用
  • 举报
  • 管理
  • TOP
回复次数:6
  • SearchLife
  • 等 级:
#1楼 得分:0回复于:2008-12-25 18:15:28 up
  • 对我有用[0]
  • 丢个板砖[0]
  • 引用
  • 举报
  • 管理
  • TOP
精华推荐:用C++判断字符串是否为中文
  • quzuoai
  • (两平行线相交)
  • 等 级:
#2楼 得分:0回复于:2008-12-26 23:02:20 高手都混哪里了?
  • 对我有用[0]
  • 丢个板砖[0]
  • 引用
  • 举报
  • 管理
  • TOP
精华推荐:在c/c++中怎样获得系统的时间
  • baisoo
  • 等 级:
#3楼 得分:0回复于:2009-01-08 23:42:18 把那个DLL复制到system32,或VS2008的VC下的那个bin文件夹下。Just try。
  • 对我有用[0]
  • 丢个板砖[0]
  • 引用
  • 举报
  • 管理
  • TOP
精华推荐:前天面深信服的一套比试题 有点意思~~~~ 大家研究下好么?
  • zy1691
  • (Rock Chao)
  • 等 级:
#4楼 得分:0回复于:2009-01-09 03:38:07 mysql++这个东西配置起来是比较麻烦,也没什么说明,要设置包含一堆东西,新手应该会比较头疼的。
其实很简单,下载mysql++的源码,然后打开解决方案,vc2008或者vc2005里面,编译之后就能看见几个dll和lib文件,lib是编译时需要的,而dll是你运行时需要的。
我自己做了一个头文件,以便以后工程里用的时候比较简单点。

发出来你看着用吧。
C/C++ code
//-----------------------mysql++ header--------------------------------------------------#ifndef MYSQL_NEED_HEADER#define MYSQL_NEED_HEADER//#include #include #include "./mysql++/include/mysql++.h"#ifdef WIN32#ifdef NDEBUG#pragma comment (lib,"./mysql++/lib/release/libmysql.lib")#pragma comment (lib,"./mysql++/lib/release/mysqlpp.lib")#pragma comment (lib,"./mysql++/lib/release/mysqlpp_excommon.lib")#else#pragma comment (lib,"./mysql++/lib/debug/libmysql.lib")#pragma comment (lib,"./mysql++/lib/debug/mysqlpp.lib")#pragma comment (lib,"./mysql++/lib/debug/mysqlpp_excommon.lib")#endif#endif#endif//手动设置附加包含目录".\mysql++\mysql"//设置生成后事件 copy .\mysql++\lib\release\*.dll .\release

winsock.h和windows.h都是mysql编译需要的文件
当然不要忘了mysqlpp同样需要mysql原本的库,都设置好以后就ok了。祝你成功~!
  • 对我有用[0]
  • 丢个板砖[0]
  • 引用
  • 举报
  • 管理
  • TOP
精华推荐:进程的问题
  • icefire1988
  • (icefire1988)
  • 等 级:
#5楼 得分:30回复于:2009-05-07 19:13:16 我给你发了一份实例了,呵呵
  • 对我有用[0]
  • 丢个板砖[0]
  • 引用
  • 举报
  • 管理
  • TOP
精华推荐:超级恶心的面试题
  • myjianghe
  • 等 级:
#6楼 得分:0回复于:2009-05-26 15:40:58 你能把你的SQLAPI++ 给我一份吗?
我的邮箱是myjianghe@sina.com,谢谢。