【发布时间】:2015-08-02 14:10:33
【问题描述】:
<connectionStrings>
<add name="mycollegeproject" connectionString="Data Source=mssql2.gear.host;Initial Catalog=mycollegeproject;Persist Security Info=True;User ID=mycollegeproject;Password=*******" />
</connectionStrings>
public static string strcon = ConfigurationManager.ConnectionStrings["mycollegeproject"].ConnectionString;
还有错误
System.NullReferenceException: Object reference not set to an instance of an object.
【问题讨论】:
-
请给我们看看 web.config
-
app.config/web.config中有连接字符串“mycollegeproject”吗?连接字符串的名称区分大小写 -
不要在帖子中提及密码。
-
参考此链接 [在此处输入链接描述][1] [1]:stackoverflow.com/questions/18431147/… 这应该可以解决您的问题
标签: c# asp.net web-config connection