Question

I need to convert from a SQLVARCHAR to a string data type

Variable definitions as follows:

string strFirstName;

SQLVARCHAR rtnFirstName[50];

Want to be able to accomplish the following:

if (strFirstName.empty()) strFirstName = rtnFirstName;

Gives an error that the binary '=': no operator found which takes a right-hand operand of type 'SQLVARCHAR[50]' (or there is no acceptable conversion)

Was it helpful?

Solution

What database API are you using? All the Google hits I can find for SQLVARCHAR say it's an unsigned char, so you can do something like this:

strFirstName = reinterpret_cast<char*>(rtnFirstName);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top