|
-
Mar 24th, 2013, 09:50 AM
#1
Thread Starter
Member
[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
-
Mar 24th, 2013, 10:25 AM
#2
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
-
Mar 25th, 2013, 06:03 AM
#3
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.
-
Mar 25th, 2013, 06:34 AM
#4
Thread Starter
Member
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
 Originally Posted by Evil_Giraffe
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.
-
Mar 25th, 2013, 06:40 AM
#5
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.
-
Mar 25th, 2013, 07:19 AM
#6
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.
-
Mar 26th, 2013, 02:33 AM
#7
Thread Starter
Member
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
 Originally Posted by DataMiser
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.
-
Mar 26th, 2013, 03:09 AM
#8
Registered User
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.
-
Mar 26th, 2013, 04:48 AM
#9
Thread Starter
Member
Re: Multiple companies
 Originally Posted by afreen
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...
-
Mar 26th, 2013, 09:09 AM
#10
Re: Multiple companies
 Originally Posted by afreen
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|