Integrate AppConfig file
-
Does anyone know anything about AppConfig files and how to integrate them into a SQL application because it is the only way i can think of to install my app on other computers and somewhat painlessly setup the connection string for the app. I know nothing about XML. HELP ME
-
Does anyone know anything about AppConfig files and how to integrate them into a SQL application because it is the only way i can think of to install my app on other computers and somewhat painlessly setup the connection string for the app. I know nothing about XML. HELP ME
Right click on your project, select "Add -> New Item" and select "Application Configuration File". Make sure it is called "App.Config". On your application drag from the toolbar to your form a "SqlConnection" object. View properties of SqlConnection object and select "Dynamic Properties" then Check the default "Connection String". Next, create a connection string and save all. By now you should see in "App.Config" a key value pair that is added for your SqlConnection object and its connection string. To read from your code: using System.Configuration myConnectionString = ConfigurationSettings.AppSettings("your key name")
-
Does anyone know anything about AppConfig files and how to integrate them into a SQL application because it is the only way i can think of to install my app on other computers and somewhat painlessly setup the connection string for the app. I know nothing about XML. HELP ME
I you want to do this in code (versus the IDE) let me know, or, if you need XML that you can read AND write from code (like by screens from user input) let me know. I have some real-work examples. If the IDE workds for you - great. Good luck - Len Thanks, -Len Miller "If I had eight hours to chop down a tree, I'd spend six sharpening my axe." -Abraham Lincoln
-
Does anyone know anything about AppConfig files and how to integrate them into a SQL application because it is the only way i can think of to install my app on other computers and somewhat painlessly setup the connection string for the app. I know nothing about XML. HELP ME
This is how u have to place ur connectionstring in your app.config file.
<configuration>
<appSettings>
<add key="DBConnString" value="Data Source=ervername;Initial Catalog=Databasename;User ID=userid;Password=password;"/>
</appSettings>
</configuration>For accessing this value from DB you can use this line of code in vb.net (in case of C# hope u can manage it, or ask me)
Public Shared CONNECTSTRING As String = System.Configuration.ConfigurationSettings.AppSettings("DBConnString")
Hope its fine and ur prob is solved.
Het Waghela :)Be Humble in Victory and Strong in Defeat.:) Het Waghela, Blog|Het Waghela DotNet Questions Link|