Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with table locking using VB and VC on Access 97

Status
Not open for further replies.

MinorityReport

Programmer
Jan 31, 2008
1
MY
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.
 
I don't see any code relating to a connection object; try closing and reopening the connection before attempting to read the updates.

Knowledge is knowing a tomato is a fruit; Wisdom is not putting it in a fruit salad.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top