2
Answers

Dynamic connection string

Photo of msnelling

msnelling

21y
1.6k
1
Sorry about being unclear. I am new to .NET and I am unsure of how to go about this program. The questions I am asking are very broad because I don’t know where to start. I can refine them as the conversation progresses. I have no set parameters for this program. I want to end up with a small program that can be distributed to companies and easily installed. I assume MSDE would be the best to thing to use considering the target users. Project: 8-10 forms each with 1 or more data grids This will NOT be deployed to the net. It is a stand alone program that requires a database to store data. The database must be with the program. Database: MSDE Total size will never exceed 1 Gig (I am assuming this is the DB of choice in this situation) Target users: The program will be distributed to a variety of small businesses who are all windows users. These businesses are not connected to each other by a network and are unrelated to each other. Goal: To create a small program that I could distribute to these companies. It will be self contained in that it will come with the program and the database in one package. I would like one connection string available to the whole application. Questions: Is it difficult/possible to make the program so it can be installed on either a network or on a single machine? If it is difficult…forget the network stuff for now. As for the questions concerning when I want to supply the db name and such. I have no clue, nor do I have any preferences. What is the easiest and most efficient way to do it? If possible I would like to end up with a connection module that I can reuse. You would think something so basic would be a bit more stratigh forward.

Answers (2)

0
Photo of kovan
NA 636 0 21y
have a preference section in your application where the user can select the database file themselves (network or local) just use the OpenFileDialog to give the user browsing ability to locat the database then save this path in a xml file or registry or INI (prefered way is a .config or xml file..
0
Photo of Adam Erstelle
NA 343 0 21y
I am using the ODBC .Net provider for accessing the database. I am in a similar situation, and have generated my Connection string based on a value that I set somewhere (can be hard coded or in a .ini file, or in the registry) With ODBC, you can set the DSN name to be almost anywhere. I am limited because I use an Access Database, so I have to have a network drive mapped in order for the database to be available. Hope this helps Wiggum