Combining C++ with Mysql

Hello,
Im currently having some issues with trying to combine these two not been able to find a guide which im able to follow 100% except one where I managed to construct this code from, though its using outdated libaries etc. No compile errors but i get the dreaded
"First-chance exception at 0x7c812a6b in thiswillworkthistime.exe: 0x000006BA: The RPC server is unavailable."

There is only one record with three entry's(columns) currently in my sql database. Here is the code I am using,
#include
#include
#include
#include
#define host "localhost"
#define username "root"
#define password NULL
#define database "db"
#define name2 5
#define password2 5
#define id2 5
MYSQL *conn;
int main()
{
std::string result[name2][password2][id2];
conn = mysql_init(NULL);
mysql_real_connect(conn,host,username,password,database,0,NULL,0);
MYSQL_RES *res_set;
MYSQL_ROW row;


mysql_query(conn,"SELECT * FROM users WHERE userid=1");
res_set = mysql_store_result(conn);
std::cout<<res_set;

mysql_close(conn);
std::cin.get();
return 0;
std::cin.get();
}

the std::cout<<res_set; is only outputting "00000000"
Any help with this code or recommended tuorials to try out would be great thanks.

Matt
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories