Solved

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

Posted on 2010-08-26
7
710 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
  • 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
Independent Software Vendors: 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

762 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