Non Gamstop Betting SitesNon Gamstop CasinosBest Casinos Not On GamstopNon Gamstop CasinoCasino Not On Gamstop

Update - Worked Example


key : purple - original code / blue - new code

Step 1 :

Link the Update menu item to an OnUpdate() function within the View. Add the following code. The name Mr William Shakespear will be changed to the name Mr William Wordsworth within the database.

void CInterView::OnUpdate()
{

_RecordsetPtr pRecordSet;
CInterDoc * pDoc;
pDoc = GetDocument();

HRESULT hr;
_bstr_t bstrQuery(
"SELECT * FROM Names WHERE ID = 76");
_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;

try
{

hr = pRecordSet.CreateInstance(_uuidof(Recordset));
if (SUCCEEDED(hr))
{

pRecordSet->PutRefActiveConnection(pDoc->m_pConnection);
hr = pRecordSet->Open(_variant_t(bstrQuery), vNull,
adOpenForwardOnly, adLockOptimistic, adCmdText);
if (!pRecordSet->GetadoEOF())
{

pRecordSet->PutCollect(L"SecondName",
L"Wordsworth");
pRecordSet->Update(vNull, vNull);
pRecordSet->Close();

}

}

}
catch( _com_error &e )
{

TRACE( "Error:%08lx.\n", e.Error());
TRACE( "ErrorMessage:%s.\n", e.ErrorMessage());
TRACE( "Source:%s.\n", (LPCTSTR) _bstr_t(e.Source()));
TRACE( "Description:%s.\n", (LPCTSTR) _bstr_t(e.Description()));

}
catch(...)
{

TRACE( "\n*** Unhandled Exception ***\n" );

}

}


Click here for the basic exercise

Click here for the source code

Click here to return to menu

Worth your time