Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Database access with 2 applications at the same time


Reply
 
Thread Tools Display Modes
  #1  
Old 10-17-2003, 03:23 AM
janigorse janigorse is offline
Newcomer
 
Join Date: Oct 2003
Posts: 4
Default Database access with 2 applications at the same time


Well here again is my problem:
I have 2 identical aplications, that have access
to the same database (lets say Northwind.mdb).
When I'm trying to access to the database with both
applications one of them generates an error. I'm trying
to solve this problem so, that the second
application will wait and then access the base when the first will
finished. I don't have a clue how to do this. Can you help me please?

Thanks,
Jani
Reply With Quote
  #2  
Old 10-17-2003, 03:29 AM
Shurik12 Shurik12 is offline
Steppe Walker

Retired Moderator
* Expert *
 
Join Date: Jul 2002
Location: Ukraine/Russia/Belgium
Posts: 7,227
Default

Hi,

It woud be nice to know what kind of error you are getting.

In general to see whether the database is already opened by another user you could check for the .ldb file which is generated when someone opens the .mdb file.
Reply With Quote
  #3  
Old 10-17-2003, 03:32 AM
Peperl's Avatar
Peperl Peperl is offline
Senior Contributor
 
Join Date: Apr 2003
Location: Cartagena, Spain
Posts: 1,371
Default An idea

You could open the adocd, give the values of the fields to the textboxes, combos, etc, and close the connection, and when you update or add new values, return to open the connection, save it and close again the connection.

When you re-open the connection, i think you could test if the database is being using by other application using the On error procedure ...

Is only an idea, 'cos I made something like this time ago ... but that doesn't have to mean that it is a good idea.
__________________
Pri Oh Persia
Reply With Quote
  #4  
Old 10-17-2003, 03:42 AM
janigorse janigorse is offline
Newcomer
 
Join Date: Oct 2003
Posts: 4
Default

Quote:
Originally Posted by Shurik12
Hi,

It woud be nice to know what kind of error you are getting.

In general to see whether the database is already opened by another user you could check for the .ldb file which is generated when someone opens the .mdb file.



Hi! Thanks for reply. Im getting this error:
"Run-time error '3356':
You attempted to open a database that is already opened exclusively by user 'admin' in machine 'W05'. Try again when the database is avaliable"

Well, I completly understand the problem. What I don't know is: How to tell the application to "wait for 2nd to finish with accessing the database"??
Reply With Quote
  #5  
Old 10-17-2003, 04:00 AM
irri irri is offline
Centurion
 
Join Date: Aug 2003
Posts: 134
Default

Quote:
Originally Posted by janigorse

Hi! Thanks for reply. Im getting this error:
"Run-time error '3356':
You attempted to open a database that is already opened exclusively by user 'admin' in machine 'W05'. Try again when the database is avaliable"

Well, I completly understand the problem. What I don't know is: How to tell the application to "wait for 2nd to finish with accessing the database"??




peperl allready gave u this option, Use an disconnected recordset. Or get a databace program that allows multiple users.
__________________
!!! The smaller the mistake, The bigger the problem !!!
!!! When the end is near, embrace it..Why sufer if it isn't nessecery !!!
Reply With Quote
  #6  
Old 10-17-2003, 04:16 AM
janigorse janigorse is offline
Newcomer
 
Join Date: Oct 2003
Posts: 4
Default

Quote:
Originally Posted by irri

Or get a databace program that allows multiple users.



Well here is the catch! I only need 1 user to access at the same time. I just want to acomplished that one application wait. And I really don't have a clue how to do it. Thats it! Thanks guys!
Reply With Quote
  #7  
Old 10-17-2003, 04:46 AM
irri irri is offline
Centurion
 
Join Date: Aug 2003
Posts: 134
Default

Quote:
Originally Posted by janigorse
Quote:
Originally Posted by irri

Or get a databace program that allows multiple users.



Well here is the catch! I only need 1 user to access at the same time. I just want to acomplished that one application wait. And I really don't have a clue how to do it. Thats it! Thanks guys!




there is a windows api call which waits until a pid is done (processor id), you could use that for your application.
__________________
!!! The smaller the mistake, The bigger the problem !!!
!!! When the end is near, embrace it..Why sufer if it isn't nessecery !!!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query time against Access database, Interesting observation c00lbeans Database and Reporting 1 09-08-2003 10:50 AM
Help regarding permission to modify Access 2K database. FacJoe Database and Reporting 1 06-18-2003 11:25 PM
Can ASP & VB6.0 access Microsoft Access database at the same time? princeshawn Database and Reporting 2 06-18-2003 06:22 AM
use Access to close another Access app strBean Word, PowerPoint, Outlook, and Other Office Products 20 12-20-2002 02:47 PM
User-defined type not defined (im new) skript_kiddie General 8 06-16-2002 02:06 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->