[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 747
  • Last Modified:

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

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
RekhaShah
Asked:
RekhaShah
  • 4
  • 2
1 Solution
 
ElrondCTCommented:
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
 
LucasCommented:
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
 
RekhaShahAuthor Commented:
mple code will be great.
0
Industry Leaders: 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!

 
RekhaShahAuthor Commented:
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
 
RekhaShahAuthor Commented:
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
 
RekhaShahAuthor Commented:
I think I will close this question and post as a different question.
0
 
ElrondCTCommented:
I'm sorry I couldn't help further. Good luck.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now