Pointer for class not working that well. Syntax I think.

I'll be gratefull for any help. Thanks.
:slight_smile:
This is the non class type error:
[root@dsgfedora01 dsgsports]# g++ -I/usr/include/mysql -I/usr/include/mysql++ -lmysqlpp -L/usr/lib/mysql -L/usr/local/lib/mysql++ loaddsgsports.cpp -o loaddsgsports
loaddsgsports.cpp: In function �int outputToImport(const char*, const char*, mysqlpp::Connection*)�:
loaddsgsports.cpp:13:33: error: request for member �query� in �pconn�, which is of non-class type �mysqlpp::Connection*�

This is my code:
#include </usr/include/mysql++/mysql++.h>
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <string.h>
using namespace std;

int outputToImport(const char* tbl_name, const char* output, mysqlpp::Connection* pconn) {
char squery[512];
sprintf(squery,"TRUNCATE TABLE %s;", tbl_name);
std::cout << squery << std::endl;
mysqlpp::Query pquery = pconn.query(squery);

}

int main()
{
mysqlpp::Connection conn(false);

if (conn.connect("dsgsports","127.0.0.1" , "root", "")) {
printf("Connected to database.\n");
}
else {
printf("Failed to connect to database.");
return 1;
}
outputToImport("aa","aa", &conn);
return 0;
}

Very very close. You don't use . on pointers, you use ->, so: pconn->query(squery);

What's "output" for, by the way?