cpp mysql InvalidArgumentException/anyone familiar with SQLString?

386 Views Asked by At

I'm using VS 2008. In a function call to a sql db table, I have

boost::scoped_ptr<sql::PreparedStatement> pstmt( conn->prepareStatement(query) );

boost::scoped_ptr<sql::ResultSet> prow( pstmt->executeQuery() );  

The query looks fine, if I copy it and run it in mySql workbench, I do get a record.

but prow( pstmt->executeQuery() threw sql::InvalidArgumentException

If I click continue, I get Unhandled exception ... Access violation reading location 0xfeeefef6

__CLR_OR_THIS_CALL ~basic_string()
    {   // destroy the string
    _Tidy(true);
    }

in a file called xstring.

The most relevant thing I've found is THIS

Where the answer is to change string to SQLString for all the connection params, but I don't know what header file I need for SQLString?

or perhaps there are other solutions?

Thanks.

1

There are 1 best solutions below

0
On

set your resultSet to first row fetched after execution of query. like in MYSQL connector

ResultSet * resultSet; (query execution code) records return in resultSet resultSet->first(); resultSet->getString("fieldName");

the the bold statement is missing then you would probably got this exception.