views:

95

answers:

1

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 typ 'SQLVARCHAR[50]' (or there is no acceptable conversion)

+2  A: 

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);
John Millikin