GetConnSting函數在sqlhelper類中。該類使用到了ConfigurationManager。
sqlhelper在編譯的過程中遇到問題,問題原因是ConfigurationManager無法識別。
ConfigurationManager是Configuration集中的類。
而我在命名空間引用了Configuration。
using System.Configuration;
爲何還是會報錯呢?
發現是由於雖然在我在命名空間引用了Configuration,但是沒有引用它的程序集實體文件。
即,System.Configuration.dll
解決方法:在解決方案與資源管理器中,右鍵“引用”,引用System.Configuration.dll文件,即可解決該問題。