I am making a erp using WPF-C# and i have a confustion on how can i connect my app to sql server after compiling. I am asking this because my app connects to DB when i compile it with Visual Studio and SQL server is already installed on my pc, So my erp app works fine on my pc but the issue is that when i run the app on another computer, App runs but DB connection failed. I installed SQL server to another computer but not working.
So i make a form which ask DB connection parameters at the start of the app and user type DB parameters and my app check that DB exist or not. The issue that where i save DB info if it exist, i cant save it in db because app need parameters to connect to DB. So tell me how i save these DB parameter locally that my app checks that the info exist or not , if exist app connects to db and if not a form will appear to user to give DB info.

Use a file. Xml file would work well. Search how to read/write to an XML file. Or you can just save the connection information to a text file.

Edited 2 Years Ago by cgeier

But the XML or Text file is readable to client, client can see the file. Is there any other way to save info.

Is there is no method like in web (Sessions and cookies). Client can delete that file accidentally. There should be another way. I see many software which ask info before first start but they dont create a particular file. Tell me another way of doing this ?

Cookies are files and can also be deleted. A user should be able to delete any file on his/her computer--in my opinion. Efforts to prevent such deletion are typically found in malicious software. Additionally, if you place your file in a folder with the name of the software, users know that if they delete files for a program that the program may no longer work properly. If you or your company own the computer you can set up access restrictions. If the user accidently deletes the file containing information he/she entered, then re-prompt the user for the information and re-create the file. Alternatively, you could store the information in the registry.

Edited 2 Years Ago by cgeier

This article has been dead for over six months. Start a new discussion instead.