hi all,
I am having server and client code in VC6 so i updated the server code from VC6 to
VC8 now the server code is not able to return the BSTR * value to the client .
The client is still in VC6 only.
The client is in Release Min Dependency and the server code is in unicode character set
The client is calling the server function from
////////////////////////////Client Code ///////////////////////////
CComBSTR bstrPSRSSName;
int intResult;
ISupportUnit * pSupportUnit;
pSupportUnit->GetCurrentSystemSetup(CComBSTR(mstrSupportUnitName),&bstrPSRSSName.m_str,&intResult);
/////////////////////////////////END OF CLIENT CODE///////////////////////////////
//////////////////////////server code ///////////////////////////////////
STDMETHODIMP CSupportUnit::GetCurrentSystemSetup(BSTR bstrSUName, BSTR *bstrSSName,int *intResult)
{
// USES_CONVERSION ; // shan;
//Update to Database
CComBSTR bstrQuery(_T("SELECT txtSystemSetup FROM tSupportUnitInfo WHERE txtSUName='"));
bstrQuery.AppendBSTR(bstrSUName);
bstrQuery.Append(_T("' "));
CComBSTR bstrResult(_T("Nothing"));
fncExecuteQuery(bstrQuery,bstrSSName,intResult);
return S_OK;
}
void CSupportUnit::fncExecuteQuery(BSTR bstrQuery, BSTR *bstrResult,int *intResult, BOOL blnIsUpdate)
TCHAR lpConnectionString[100];
TCHAR sql[1000];
HRESULT hr;
BOOL blnConnected=FALSE;
_RecordsetPtr mpRecordSet;
_ConnectionPtr mpConnection;
mpConnection.CreateInstance(__uuidof(Connection));
CString strDBName = CString(mbstrDBName.copy()) ;
swprintf(lpConnectionString,_T("Provider=Microsoft.Jet.OleDB.4.0;Data Source=%s"),strDBName);
try
hr=mpConnection->Open(_bstr_t(lpConnectionString),mbstrDBUser,mbstrDBPwd,adModeUnknown);
if(SUCCEEDED(hr))
blnConnected=TRUE;
swprintf(sql,CString(bstrQuery));
if(blnIsUpdate)
mpConnection->Execute(sql,NULL,0);
*intResult=ERR_NONE;
else
mpRecordSet.CreateInstance(__uuidof(Recordset));
mpRecordSet->Open(sql,mpConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
if(VARIANT_FALSE==mpRecordSet->adoEOF)
_bstr_t bstrColDelim("~");
_bstr_t bstrRoDelim("@");
_bstr_t bstrUserString;
_bstr_t bstrQueryResult;
bstrQueryResult=mpRecordSet->GetString(adClipString,1000,bstrColDelim,bstrRoDelim," ");
*bstrResult=bstrQueryResult.copy();
mpRecordSet->Close();
mpConnection->Close();
_bstr_t bstrQueryResult("No Records Found");
return;
catch(_com_error e)
BSTR bstrErr=e.Description().copy();
if(DEBUG_LEVEL_ONE)
fncLogDebugMsg(CString(bstrErr));
*intResult=ERR_UNKNOWN;
///////////////////////////////END OF SERVER CODE/////////////////////////////////
//////////////////////////////SERVERS IDL FILE /////////////////////////////////
[id(26), helpstring("method GetCurrentSystemSetup")] HRESULT GetCurrentSystemSetup(BSTR bstrSUName,[out
]BSTR *bstrSSName,int *intResult);
///////////////////////// END OF IDL FILE////////////////////////////////////////
My Server code in VC6 worked properly but when i upgraded it to VC8 it is not able to return bstrSSName
value and also giving runtime exception after calling GetCurrentSystemSetup function
so pls tell me if there are any more changes to be made so that i would get the bstrSSName and also
avoid from Runtime Exception ie
" The exception unknown software exception (0xc0000409 ) occurred in the application at location
0x0040a576"