How to app.config file used in windows application with example sample
vb.net windows application
Collapse
X
-
Tags: None
-
===========Originally posted by Jayesh ChauhanHow to app.config file used in windows application with example sample
this is the .config file using for database connection
===========
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<appSettings>
<add key="DB:ExpDB" value="Integrat ed Security=SSPI;P ersist Security Info=False;User ID=sa;Initial Catalog=ExpDB;D ata Source=Server_n ame;"/>
<add key="DB:ExpDB:s rv" value="Server_n ame"/>
<add key="DB:ExpDB:i cat" value="ExpDB"/>
<add key="DB:ExpDB:u id" value="sa"/>
<add key="DB:ExpDB:p wd" value="sa"/>
</appSettings>
</configuration>
============
in the coding cretae method like this
=============== ===
Private MCLRE_conString As String = ConfigurationSe ttings.AppSetti ngs.Get("DB:Exp DB")
Public Function connection(ByVa l con As SqlConnection) As SqlConnection
Try
con.ConnectionS tring = MCLRE_conString
Catch ex As Exception
MsgBox(ex.Messa ge.ToString())
End Try
End Function
:) regards Angi
Comment