15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Multiple access to Access Database using ODBC

Marco Valerio -- Marco.Valerio@italtel.it
Friday, March 21, 1997

Environment:  Windows 95, VC++ 4.2b

I've a Access database on my NT server; if I try to add records
(CRecordSet->AddNew()) to the same table from two different clients I've
problems (of course). Which are the techniques available with ODBC to deal
with the update of the same database from multi user ?

the error is:
"Couldn't update currently locked by user '...' on machine '...'  "

{
	pRec->AddNew();

            // Recorset variables
            pRec->m_TipoDocumento = str;
	pRec->m_TDDescrizione = "descr";
	pRec->m_TDCategoria = "SEMPLICE";
	pRec->m_TDApplicazione = "Word";
	pRec->m_TDParametri = "R/W";
				
	while (! pRec->CanUpate());
            // I've tried to use SetLockingMode( CRecordset::optimistic )
before calling OnUpdate()             // function, but the problem is the
same.
	pRec->Update();
}

	pRec->Requery();


Thank you in advance for your help

---------------------------------------------------------
Marco.Valerio@italtel.it
---------------------------------------------------------


---------------------------------------------------------
Marco.Valerio@italtel.it
---------------------------------------------------------



Ravi M. -- guentert@giasmd01.vsnl.net.in
Tuesday, March 25, 1997

Hi!
The problem here is not with the way the ODBC is being used. It is the =
way the Access database does locking of its tables. Access goes with the =
locking of a Pagesize of 2K in a table. Thus it always locks more than =
one record giving rise to the conflict. One way to solve this: Pad each =
record with empty field(s) so that the size is 2K and Access will not =
start a new record in part of a page.=20

Ravi M.

----------
From: 	Marco Valerio[SMTP:Marco.Valerio@italtel.it]
Sent: 	Friday, March 21, 1997 6:25 PM
To: 	MAIL MFC
Subject: 	Multiple access to Access Database using ODBC

Environment:  Windows 95, VC++ 4.2b

I've a Access database on my NT server; if I try to add records
(CRecordSet->AddNew()) to the same table from two different clients I've
problems (of course). Which are the techniques available with ODBC to =
deal
with the update of the same database from multi user ?

the error is:
"Couldn't update currently locked by user '...' on machine '...'  "

{
	pRec->AddNew();

            // Recorset variables
            pRec->m_TipoDocumento =3D str;
	pRec->m_TDDescrizione =3D "descr";
	pRec->m_TDCategoria =3D "SEMPLICE";
	pRec->m_TDApplicazione =3D "Word";
	pRec->m_TDParametri =3D "R/W";
			=09
	while (! pRec->CanUpate());
            // I've tried to use SetLockingMode( CRecordset::optimistic =
)
before calling OnUpdate()             // function, but the problem is =
the
same.
	pRec->Update();
}

	pRec->Requery();


Thank you in advance for your help

---------------------------------------------------------
Marco.Valerio@italtel.it
---------------------------------------------------------



Mark Foley -- meftech@concentric.net
Thursday, March 27, 1997

Ravi M. wrote:
> 
> Hi!
> The problem here is not with the way the ODBC is being used. It is the =
> way the Access database does locking of its tables. Access goes with the =
> locking of a Pagesize of 2K in a table. Thus it always locks more than =
> one record giving rise to the conflict. One way to solve this: Pad each =
> record with empty field(s) so that the size is 2K and Access will not =
> start a new record in part of a page.=20
> 
> Ravi M.
> 
> ----------
> From:   Marco Valerio[SMTP:Marco.Valerio@italtel.it]
> Sent:   Friday, March 21, 1997 6:25 PM
> To:     MAIL MFC
> Subject:        Multiple access to Access Database using ODBC
> 
> Environment:  Windows 95, VC++ 4.2b
> 
> I've a Access database on my NT server; if I try to add records
> (CRecordSet->AddNew()) to the same table from two different clients I've
> problems (of course). Which are the techniques available with ODBC to =
> deal
> with the update of the same database from multi user ?
> 
> the error is:
> "Couldn't update currently locked by user '...' on machine '...'  "
> 
> {
>         pRec->AddNew();
> 
>             // Recorset variables
>             pRec->m_TipoDocumento =3D str;
>         pRec->m_TDDescrizione =3D "descr";
>         pRec->m_TDCategoria =3D "SEMPLICE";
>         pRec->m_TDApplicazione =3D "Word";
>         pRec->m_TDParametri =3D "R/W";
>                         =09
>         while (! pRec->CanUpate());
>             // I've tried to use SetLockingMode( CRecordset::optimistic =
> )
> before calling OnUpdate()             // function, but the problem is =
> the
> same.
>         pRec->Update();
> }
> 
>         pRec->Requery();
> 
> Thank you in advance for your help
> 
> ---------------------------------------------------------
> Marco.Valerio@italtel.it
> ---------------------------------------------------------
Have you tried using Dynasets? I use these with Access for multiple
concurrent user access and do record locking on my own. Dynasets are
described in the MSDN documentation.



David Little -- dlittle@equinoxcorp.com
Friday, March 28, 1997

How do you do your own record locking in ODBC?

----------
From: 	meftech[SMTP:meftech@concentric.net]
Sent: 	Thursday, March 27, 1997 9:54 AM
To: 	mfc-l@netcom.com
Subject: 	Re: Multiple access to Access Database using ODBC

Ravi M. wrote:
> 
> Hi!
> The problem here is not with the way the ODBC is being used. It is the =
> way the Access database does locking of its tables. Access goes with the =
> locking of a Pagesize of 2K in a table. Thus it always locks more than =
> one record giving rise to the conflict. One way to solve this: Pad each =
> record with empty field(s) so that the size is 2K and Access will not =
> start a new record in part of a page.=20
> 
> Ravi M.
> 
> ----------
> From:   Marco Valerio[SMTP:Marco.Valerio@italtel.it]
> Sent:   Friday, March 21, 1997 6:25 PM
> To:     MAIL MFC
> Subject:        Multiple access to Access Database using ODBC
> 
> Environment:  Windows 95, VC++ 4.2b
> 
> I've a Access database on my NT server; if I try to add records
> (CRecordSet->AddNew()) to the same table from two different clients I've
> problems (of course). Which are the techniques available with ODBC to =
> deal
> with the update of the same database from multi user ?
> 
> the error is:
> "Couldn't update currently locked by user '...' on machine '...'  "
> 
> {
>         pRec->AddNew();
> 
>             // Recorset variables
>             pRec->m_TipoDocumento =3D str;
>         pRec->m_TDDescrizione =3D "descr";
>         pRec->m_TDCategoria =3D "SEMPLICE";
>         pRec->m_TDApplicazione =3D "Word";
>         pRec->m_TDParametri =3D "R/W";
>                         =09
>         while (! pRec->CanUpate());
>             // I've tried to use SetLockingMode( CRecordset::optimistic =
> )
> before calling OnUpdate()             // function, but the problem is =
> the
> same.
>         pRec->Update();
> }
> 
>         pRec->Requery();
> 
> Thank you in advance for your help
> 
> ---------------------------------------------------------
> Marco.Valerio@italtel.it
> ---------------------------------------------------------
Have you tried using Dynasets? I use these with Access for multiple
concurrent user access and do record locking on my own. Dynasets are
described in the MSDN documentation.




Become an MFC-L member | Вернуться в корень Архива |