5

I am using Ado.Net Connectivity Framework in my WPF application.

There is kind of a form in my MainWindow.xaml file. This form has two fields one is asking for database name and second is for PC Name.

Questions:

  1. I want to pass these values to App.config File in my WPF application. How to pass these values?

  2. Secondly I have to make my database centralized and my application launched from different computers have to access this centralized database?

  3. The way I am making this to access centralized database via these above defined fields is right way or is this is not a way to achieve required goal?

enter image description here

13
  • If you break down the components in connectionstring to AppSetting and then you can read and write. codeproject.com/Articles/14744/… Not sure how writing to the local app.config is going to address #3? Commented Sep 23, 2013 at 16:24
  • 3
    I'm a little confused here. If the database is supposed to be centralized (item 2), why are you asking the user for a database name? All uses I know of for "central" means there is exactly one. Also, why do you ask the user for their PC name? Wouldn't a better plan be to just simply pull that from the machine itself? Commented Sep 23, 2013 at 16:27
  • 1
    So, you have a database, located in a centralized location, and you want each of your client applications to access it? Commented Sep 23, 2013 at 16:40
  • 1
    A connection string is just a way to point your application to a data source, wherever that data source may be. It does not need to know where it is (your local pc) just where it is going (your server). Does that help? Commented Sep 23, 2013 at 16:54
  • 1
    Create a proper connectionstring when you build the application. If it is a centralized database then all clients should have the same connection string. There are lots of examples on msdn. Commented Sep 23, 2013 at 17:24

1 Answer 1

3

We found an answer based on a good sized chat discussion.

His solution will probably require 1 of 2 things.

  1. Host a WCF service that performs CRUD operations on his database.
  2. Use a service like No IP to create a public location to his local machine, open ports for his database, and run the application with a direct connection. (he is aware of the limitations/security problems this creates)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.