Click here to Skip to main content
15,880,503 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please note that I'm not a programmer. I'm trying to learn a few things on the fly. I do have some programming knowledge though.

I'm using C# and Winforms to create my app.

I have a main database for the program which would hold the basic information about the application. Not the tables/fields used in the application itself.

On "Open", I've created a Winform that opens and has datagridview with open and cancel buttons. In the grid I'll show the list of databases for the user to select from.

I need the user to be able to select the database(company) they'll be using. This is basically a multi-company application with each companies database files saved in each individual companies sub folder. The individual databases, besides the main one, holds the actual tables/fields that the app would use.

Yes, there is/will be user control functionality implemented on a per company basis as well, which I have no issue with.

Any guidance in the right direction would be appreciated.

What I have tried:

I haven't tried anything as I don't know what the best way of approaching this would be.
Posted
Updated 27-Feb-21 9:45am
Comments
#realJSOP 27-Feb-21 15:38pm    
You need to connect to the database server in order to retrieve a list of databases that are available. Have you done that? Also, you didn't tell us what kind of database you're using. Sql Server? Oracle? Access? MySql? Something else?
Logan1980 27-Feb-21 16:06pm    
My apologies. I use SQL Server database mdf file for each company. No, I haven't tried that. The only reason I didn't "think" about that was because the database is saved as a MDF file and the "Open" form shows the different company names, not the database names.

1 solution

 
Share this answer
 
Comments
Logan1980 27-Feb-21 16:13pm    
Hi Rick,

Thanks for the info. I get the basics of it. I didn't "think" about that specifically because the database is saved as a MDF file inside the individual companies directory and the "Open" form with the grid shows the companies name not the database name.

Thanks for the info!
RickZeeland 28-Feb-21 3:12am    
I think you will run into problems this way, in the past this would have worked well with MS Access databases, but SQL Server is more difficult. I would recommend using backup files instead. Personally I stopped using SQL Server altogether in favor of PostgreSQL and never regretted it.
Logan1980 15-Mar-21 4:13am    
Sorry for the LOOOONG awaited reply. Literally only saw your reply now. Like I said, I'm a total noob. So please excuse the ignorance. I'm basing the design off of another popular application, which basically (from what I'm seeing) saves "individual" db and dat files instead of a database file. I just don't know how to achieve that. Obviously I will be having a professional programmer go through everything once I've done the basics but I'm honestly trying to do as much as possible myself and learn a new thing or two along the way. Any guidance you could give would be appreciated.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900