I am developing a client server application which will transfer an Access MDB file from the backend server to a remote client. The server is run as a service. Everything works fine EXCEPT when I add records to the MDB file and then close the file. The close statement has a tendency to crash the server. I've tried googling on the close statement but couldn't find anything relating to problems with it. Listed below is the code fragment for your review. The recordset->Close() statement is the source of the problem. Any help would be greatly appreciated.
Thanx
Bob
Code:
ADODB::_ConnectionPtr connection;
hr = connection.CreateInstance(__uuidof(ADODB::Connection));
if (FAILED(hr))
{
throw _com_error(hr);
}
ADODB::_RecordsetPtr recordset;
hr = recordset.CreateInstance(__uuidof(ADODB::Recordset));
if (FAILED(hr))
{
throw _com_error(hr);
}
_bstr_t strcnn("Provider='Microsoft.JET.OLEDB.4.0';"
"Data source = ");
strcnn += szDatabaseName;
connection->Open((const char *)strcnn,"","",ADODB::adConnectUnspecified);
memset(szInsert, 0, sizeof szInsert);
sprintf(szInsert, "INSERT INTO DELFILE3LOG VALUES ('%s','%s')",szTimeStamp,szLogRec);
recordset->Open(szInsert, connection.GetInterfacePtr(), ADODB::adOpenForwardOnly,
ADODB::adLockReadOnly, ADODB::adCmdText);
recordset->Close();
additional code.....