I am doing:
pCommand->CommandText="INSERT INTO tblTest (Color, Texture) VALUES ('navy blue', 'rusty') ";
_RecordsetPtr pRecordset;
hr = pRecordset.CreateInstance (__uuidof (Recordset));
if (FAILED (hr))
{
AfxMessageBox ("Can't create an instance of Recordset");
return;
}
AfxMessageBox("LLL");
pRecordset->CursorLocation = adUseClient;
pRecordset->Open ((IDispatch *) pCommand, vtMissing, adOpenDynamic, adLockBatchOptimistic, adCmdTable);
I get an exception at the open statement....
Comments
[size=2]Neo Gigs[/size]
[color=blue]http://communities.msn.com.my/VisualBasicwithNeo[/color]
//
HRESULT hr;
_CommandPtr pCommand = NULL;
_RecordsetPtr pRecordset;
pCommand.CreateInstance(__uuidof(Command));
pCommand->ActiveConnection = pConn; // attach your connection object here
pCommand->CommandTimeout = 15;
pCommand->CommandType = adCmdText;
pCommand->CommandText="INSERT INTO TableName VALUES (1,'test') ";
hr = pRecordset.CreateInstance (__uuidof (Recordset));
if (FAILED (hr))
{
AfxMessageBox ("Can't create an instance of Recordset");
return;
}
AfxMessageBox("LLL");
pRecordset->CursorLocation = adUseClient;
pRecordset->Open ((IDispatch *) pCommand, vtMissing, adOpenDynamic, adLockBatchOptimistic, adCmdText);
AfxMessageBox("Success");
// end
Enjoy...