I am connecting to my db but I am unable to return results. I need to run a select statement and load a variable.
The database connection works great!
SQL Example I need: chrName = Select Name from Table where Userid = chrUserID;
chrUserID = This variable is loaded with logon id
///////////////////////////////////////////////////////////
char chrName[50]
_ConnectionPtr pConn = NULL;
_bstr_t strCon("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=qu;Password=q;Initial Catalog=PROD;Data Source=DHB123\\TOM");
HRESULT hr = S_OK;
CoInitialize(NULL);
try
{
//Create the Connection pointer
hr = pConn.CreateInstance((__uuidof(Connection)));
if(FAILED(hr))
{
goto cleanup;
}
//Open the SQL Server connection
hr = pConn->Open(strCon,"","",0);
if(FAILED(hr))
{
goto cleanup;
}
Every piece of code I have added here has failed. No select statement works correctly.
////////////////////////////////////////////////////
Last edited on
I don't see this post in the forum. Test