Skip to content

Separate database for separate customers in a single windows c# application

arun kumar

Asked Sep 20, 2012, 3:58 AM EDT3 answers
Share
LinkedInX
Hello sir

i have created a single account software,But i need separate database (using ms access database) for separate company user account. how to create  Please Help me. i have attached the screen short


ex : company name

1. mva account 2011-2012
2.mva account 2012-2013
3 rama trading account 12-13

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Akkiraju Ivaturi
    0
    Is your requirement is to create one database per user account? Or you want to do this only for one user?
    0
  • 0
    sir, i have crate 2 or more user account in one application login page( see my uploaded pictures,)my data base structure is same but database is automatically create indidual user accounts

    ex:

    my data base name is 1.mdb
    1st user data base is rec_1.mdb        
    2nd user data base is rec_2.mdb
    etc..


    please help me
    0
  • Akkiraju Ivaturi
    0
    Arun,

    follow these steps:

    1. Create a database with whatever tables you want to use for each customer or user account. Imagine this as a template and you should not be using this. For example, call it "Master.MDB".

    2. You need to have login details and customer details stored in one more database. Call this as "Customer.MDB".

    3. So, your user account table should have following columns

    UserID        ShortName         LongName
    =====        ========        ========
    1                 ADMRM                A.D.Modern Rice Mill
    2                 CTA                     Chandru Trading Account

    Make sure that ShortName is unique.

    4. Whenever you create a new user, create a new folder with user id. For example user1 is getting created, then create a folder with name "User1".


    Then copy the "Master.DB" file to the folder path C:\User1 as below with database name as shortname.mdb:

    System.IO.File.Copy(@"C:\MDB\FPNWIND.MDB", @"C:\User1\ADRM.MDB");

    5. Whenever a user logins into the system, make sure that you connect to the database using datasource pointing to the location with the format

    "C:\" + userid + selected account shortname + ".mdb" and use this mdb file for storing the whatever you are planning.

    This makes sure that you create a new database for each user and for each account and you should be able to use it too.

    There are some examples given if you google regarding create mdb file using COM components and others which you do not need to follow. 

    Let me know if you have any questions.


     
    0