Wednesday, June 30, 2010

where to write & retrive connection string in window application ?

hi dear
the perfect place to write connection string in web application is web.config file and
in window application we can use the app.config for the application configuration
so add a app.config file to your project and add connection string section to your app.config file





after adding this to app.config file you need to retrive the connection string for the write code
is

sqlconnection =new sqlconnection(configurationmanager.connectionstrin["connectionstringname"].connectionstring);


but if u dont get configuration manger in your code then add system.configuration namespace to your file
but if u still not get the configuration manager then
add reference to your solution explorer for system.configuration and ur problem is solved


thanks

No comments:

Post a Comment