Solved

Single VB.Net app using multiple Access mdb files in windows app

Posted on 2010-08-26
7
711 Views
Last Modified: 2012-05-10
Hi Experts,
I am rewriting my current vb6 application using vb.net (vs 2008) with access database. Current app allows only one .mdb  at a time.  The new requirement is to allow users to open more than one account (each an .mdb files with multiple tables). Copy, move information from one to the other. It would be like Microsoft Word document where you can open multiple documents and view side by side and be able to drag and drop info from one to the other. I have no idea where to begin and how to use multiple connection strings (?), how to keep track of which database is user working with and so on.  I will greatly appreciate any guidance.
0
Comment
Question by:RekhaShah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 20

Expert Comment

by:ElrondCT
ID: 33538734
Multiple connections is no big deal. You simply need to have a separate OleDbConnection for each database that you want to open. What I do is make the non-changing parts of the connection string into constants, then simply tack the name of the particular database I want to open into the middle of it to create the actual connection string used:

    Public Const strConn1 As String = "Data Source="""
    Public Const strConnRW As String = """;Password=;Provider=""Microsoft.Jet.OLEDB.4.0"";" _
         & "Mode=Share Deny None;User ID=Admin;Jet OLEDB:Engine Type=5;"

    oledbconn.ConnectionString = strConn1 & strFullFile & strConnRead

You can use the same construction for any number of connections.

Drag and drop between tables is something I have no experience with, so I can't help you there.
0
 
LVL 13

Expert Comment

by:lucas911
ID: 33538768
This sounds like an interesting project.

The first thing you would have to do is setup a connections database.

LET me know if you need more help
0
 

Author Comment

by:RekhaShah
ID: 33542079
mple code will be great.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:RekhaShah
ID: 33542212
Sorry, I don't know what happenned - most part of my comment disappeared. Here we go again.
Actually, my VB6 app opens two different databases - one for the job and one with the system options. So opening the multiple databse is not the problem.  I have an array of connection strings and I build dynamically by only changing the .mdb path and name part of the string like  ElrondCN suggested.
My confusion is how do I  keep track of the databases. For example, I have one Account1.mdb open. User can edit, delete, add data to multiple tables of this mdb thru multiple winforms. Say, user opens FormJobInfo for Account1.mdb. Now user opens Account2.mdb and opens the same FormJobInfo , only, this time it is populated with Account2.mdb info. Now two instances of the FormJobInfo are displayed sidebyside and user can copy/move data between the two forms.
First, is it doable? if it is, how? It is like running two instances of my current app in a bigger container, if you will.
I think, some OO approach will be helpful in this design. Some sample code will be will great!
0
 

Author Comment

by:RekhaShah
ID: 33573041
I can open two databases using arrays of connection strings and open two instances of the same for with different data.
 But, I want this form to behave like mdi container for its multiple child forms. I know windows does not allow nested MDIs. I am looking for some ideas so that I can have that functionality.
I am sure some one out there must have done similar project! Any idea?
0
 

Accepted Solution

by:
RekhaShah earned 0 total points
ID: 33577884
I think I will close this question and post as a different question.
0
 
LVL 20

Expert Comment

by:ElrondCT
ID: 33578225
I'm sorry I couldn't help further. Good luck.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question