Select Statement in C++

The following code compiles but does not return the correct results. selectsmt is loaded with the contents of chrHostID. chrHostID is loaded with an employees user id. Example: user1. This works correctly. I need to pull one record from the Employee table based on the user id passed. I have tried a ton of different syntax in the selectsmt line but nothing works. The code runs fine if I just pass a select statement with no variable, but I need the where clause.


char chrHostID[10];

_bstr_t selectsmt = ("Select Roles from Employees where UserID = {0}", chrHostID);

RecSet = pConn->Execute(selectsmt, RecordsAffected, 1);
Topic archived. No new replies allowed.