Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

i have implemented vb functionality in c++ i have replace below logic in c++ but it is giving issue :

vb code:
VB
For Each loTDef In aoDBUser.TableDefs
          
          Set loProp = Nothing
          On Error Resume Next
          Set loProp = loTDef.Properties("Description")
                    
          If Not loProp Is Nothing Then
               If loProp.Value = TEMP_TABLE Then
               End If
          End If
     Next 

DAO_CHECK(pPrp->get_Item(varName, &pRev));//crashing


What I have tried:

C++
CString CVReportQuieres::GetCustomProperty(CString psPropertyName)
{
	//
	// OVERVIEW:
	// Get the value for the given Custom Property
	//
	DAOProperties *pColProp = NULL;
	DAOProperty *pProp = NULL;

	CDaoDatabase cDBase;
	cDBase.Open(CV_GetUserDatabasePath(_T("TEST.mdb")));

	CString strDbVer;
	DAOProperties* pPrp = 0;
	DAOProperty* pRev = 0;
	try
	{
		if ( !cDBase.IsOpen() )
			return(_T(""));

		DAO_CHECK(cDBase.m_pDAODatabase->get_Properties(&pPrp));
		if ( pPrp != 0 )
		{
			COleVariant varRevVal;
			COleVariant varName(_T("Description"), VT_BSTRT);

			DAO_CHECK(pPrp->get_Item(varName, &pRev));//crashing going to catch 

			if (pRev != 0)
			{
				DAO_CHECK(pRev->get_Value(&varRevVal));
				pRev->Release();
				pRev = 0;
			}
			pPrp->Release();
			pPrp = 0;

			strDbVer = V_BSTRT(&varRevVal);
		}
	}
	catch (...)
	{

	}

	cDBase.Close();
}
Posted
Updated 29-Jun-18 2:50am
v3
Comments
KarstenK 29-Jun-18 8:50am    
Nice work. Where is the problem? :-O
Maciej Los 29-Jun-18 8:54am    
My virtual 5!
Member 13798855 29-Jun-18 8:56am    
DAO_CHECK(pPrp->get_Item(varName, &pRev));// it is crashing here
Member 13798855 29-Jun-18 8:57am    
pRev is getting null ..iam thinking might be the issue
Member 13798855 29-Jun-18 8:58am    
could you let me know KarstenK

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900