MinorityReport
Programmer
Hi guys, I am running a program which requires multiple programs accessing to an Access 97 database (changing database is not possible I'm afraid). The programs are written in VC++ and VB6. The VC++ program only reads from the database while the updates and deletion are done from the VB programs (and also from a dll compiled from VB). The issue is my VC++ program is unable to get the latest data from the database. The programs run in the following sequence :
1)VC++ reads from tableA
2)VB6 updates tableA with new data (might call the dll to update as well)
3)VC++ reads again from tableA (unable to get updated data)
I do not know if the locking is by the VC++ programs or the VB6 programs.
Sample of the codes dealing with database records are as follows :
VC++ :
TRY {
m_rst->m_strFilter = "[ColumnID] = " + ltoCString(lColumnID);
m_rst->Requery();
if (!m_rst->IsEOF())
{
m_rst->MoveFirst();
n1= m_rst->m_Value1;
n2= m_rst->m_Value2;
return TRUE;
}
return FALSE;
} CATCH (CDBException,dbException) {
The VB6 codes :
strSQL = "UPDATE [Table1] SET [Value1] = [Value1] - 1, [Value2] = [Value2] + 1 WHERE [Column1] = " & strString
mdbTemp.Execute strSQL
as well as :
strSQL = "SELECT * FROM [Table1] WHERE [Column1] = " & strString
Set rstTemp = mdbTemp.OpenRecordset(strSQL)
With rstTemp
If Not .EOF Then
.MoveFirst
.Edit
![Value1] = strString
.Update
.Close
End If
End With
Any help or pointers is much appreciated. Is there any way I can know which program is holding up the database?
Thanks again.
1)VC++ reads from tableA
2)VB6 updates tableA with new data (might call the dll to update as well)
3)VC++ reads again from tableA (unable to get updated data)
I do not know if the locking is by the VC++ programs or the VB6 programs.
Sample of the codes dealing with database records are as follows :
VC++ :
TRY {
m_rst->m_strFilter = "[ColumnID] = " + ltoCString(lColumnID);
m_rst->Requery();
if (!m_rst->IsEOF())
{
m_rst->MoveFirst();
n1= m_rst->m_Value1;
n2= m_rst->m_Value2;
return TRUE;
}
return FALSE;
} CATCH (CDBException,dbException) {
The VB6 codes :
strSQL = "UPDATE [Table1] SET [Value1] = [Value1] - 1, [Value2] = [Value2] + 1 WHERE [Column1] = " & strString
mdbTemp.Execute strSQL
as well as :
strSQL = "SELECT * FROM [Table1] WHERE [Column1] = " & strString
Set rstTemp = mdbTemp.OpenRecordset(strSQL)
With rstTemp
If Not .EOF Then
.MoveFirst
.Edit
![Value1] = strString
.Update
.Close
End If
End With
Any help or pointers is much appreciated. Is there any way I can know which program is holding up the database?
Thanks again.