I am developing a web application using ASP.NET (VB.NET), and I set the db connection string in Web.config file under appSettings category. The application was able to read the db connection string. I don't know what I did the application cannot read the db connection string in Web.config file any more. For instance,
strConn = ConfigurationSettings.AppSettings("dbConnectionString")
strConn is always empty. I tried to create a new web project, set connection string in Web.config file, and read the connection string into a web form. It still didn't work. If you know the problem, please let me know. Thanks
Web.config file:
<?xml version="1.0" encoding="utf-8">
<configuration>
<appSettings>
<add key="dbConnectionString" value = "Data Source=(local); database=db; uid=uid;pwd=pwd;" />
</appSettings
<system.web>
...
</system.web>
</configurationYour top line should be this (notice the extra question mark):
<?xml version="1.0" encoding="utf-8" ?>
0 comments:
Post a Comment