Solved

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

Posted on 2010-08-26
7
701 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
Comment Utility
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
Comment Utility
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
Comment Utility
mple code will be great.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:RekhaShah
Comment Utility
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
Comment Utility
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
Comment Utility
I think I will close this question and post as a different question.
0
 
LVL 20

Expert Comment

by:ElrondCT
Comment Utility
I'm sorry I couldn't help further. Good luck.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now