Results 1 to 10 of 10

Thread: [RESOLVED] Multiple companies

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2013
    Posts
    37

    Resolved [RESOLVED] Multiple companies

    Im developing a accounting vb.net windows application,
    1.In this 1 company can be created with its customer n vendors. My problem is how to make multiple companies...for ex in quickbooks and many applicaiton when application starts it asks like select company..on selecting company we can add details related to that company only. If anyone knows what actually happens...Im fresher and I dont know what they are doing or what can be done...

    2.If i want to install it on client side what about database n server settign...Im making 1 form for server setting but is it actually needed or any other good solution...bcoz if client changes sa pwd or has anytoher user how can the db connection changed in my applicaiton as im saving that in app.config

    Any suggestions are welcome!!
    Thanks

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Multiple companies

    Typically I would use different tables for different companies, all with the same structure but with something that Identifies the company as part of the table names. Additionally I would have one table that has the company names and info including the prefix that would be on all the table names for that company then use that in my code to get the correct tables

  3. #3
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: Multiple companies

    I would advise against one table per company. Have a table that holds all the companies and then use the primary key from that table as an identifier on other tables (where relevant) to denote which company that record belongs to.

    In the application, I would also have a class that represents a company, and use this to access the collections of other objects relevant to that company.

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 2013
    Posts
    37

    Re: Multiple companies

    But what if I want to take backup of data of only 1 company and there are more than 20 tables and is it not time consuming if for each record im also putting company id
    Quote Originally Posted by Evil_Giraffe View Post
    I would advise against one table per company. Have a table that holds all the companies and then use the primary key from that table as an identifier on other tables (where relevant) to denote which company that record belongs to.

    In the application, I would also have a class that represents a company, and use this to access the collections of other objects relevant to that company.

  5. #5
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: Multiple companies

    Why would you backup only one company? "Back up" is something applied to the database as a whole. Maybe "Export records" for a single company, but this is a different operation entirely, and would in no perceivable way be slowed down by using a foreign key, assuming you've properly indexed your tables.

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Multiple companies

    I actually mis-spoke when I said a table per company as I meant a database per company with each DB being identical in structure and likely containing several tables.

    Of course this depends on the size needed for the data but if there is going to be a lot of records then using a separate DB would be quite a lot faster as it does not have to sift through data that is not for that company when doing transactions.

  7. #7

    Thread Starter
    Member
    Join Date
    Feb 2013
    Posts
    37

    Re: Multiple companies

    Thanks for your reply...I too thinks this will be more suitable solution for my situation bcoz i want to bakup records for particular company...but now the question is can i create a copy of the existing database with the table structure n all but with no data through code in vb.net? If yes...plz give me some hint on code or example or any links...bcoz i goodled and im getting example for creating new database programtically....as i said i have more than 25tables and it will be bit lengthy to create each table by coding...plz suggest on crating a database copy with it structure

    Quote Originally Posted by DataMiser View Post
    I actually mis-spoke when I said a table per company as I meant a database per company with each DB being identical in structure and likely containing several tables.

    Of course this depends on the size needed for the data but if there is going to be a lot of records then using a separate DB would be quite a lot faster as it does not have to sift through data that is not for that company when doing transactions.

  8. #8
    Registered User
    Join Date
    Mar 2013
    Posts
    1

    Thumbs up Re: Multiple companies

    You can use a table for Companies. For every type of voucher entry you can save it with company code in the same table of vouchers. In this way quires can show composite data and also individual data for each company.

  9. #9

    Thread Starter
    Member
    Join Date
    Feb 2013
    Posts
    37

    Re: Multiple companies

    Quote Originally Posted by afreen View Post
    Thanks for your reply...I too thinks this will be more suitable solution for my situation bcoz i want to bakup records for particular company...but now the question is can i create a copy of the existing database with the table structure n all but with no data through code in vb.net? If yes...plz give me some hint on code or example or any links...bcoz i goodled and im getting example for creating new database programtically....as i said i have more than 25tables and it will be bit lengthy to create each table by coding...plz suggest on crating a database copy with it structure
    I got this done by using SMO and i hope im on write path:

    If any one wants to refer how i did can check below :

    http://www.mssqltips.com/sqlserverti...data-with-smo/
    http://www.codeproject.com/Articles/...SQL-Server-Man

    juz trying to give back to the community...

  10. #10
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Multiple companies

    Quote Originally Posted by afreen View Post
    Thanks for your reply...I too thinks this will be more suitable solution for my situation bcoz i want to bakup records for particular company...but now the question is can i create a copy of the existing database with the table structure n all but with no data through code in vb.net? If yes...plz give me some hint on code or example or any links...bcoz i goodled and im getting example for creating new database programtically....as i said i have more than 25tables and it will be bit lengthy to create each table by coding...plz suggest on crating a database copy with it structure
    Hard to say what would be the best way to do it without knowing what DB you are using. If SQL server I would create the first DB in SQL server then script the structure to an sql file which could then be executed to create new copies of the db structure as needed. If MS Access then I would create a blank DB in Access and include a copy of that with the program then make a copy of the blank db file as needed for the new companies.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width