读取Web.config中设置
Conn = new SqlConnection(ConfigurationSettings.AppSettings[“cnFriends.ConnectString”]);
appSettings
!-- User application and configured property settings go here.--
!-- Example: add key="settingName" value="settingValue"/ --
add key="cnFriends.ConnectionString" value="data source=(local)\NetSdk;initial catalog=FriendsData;user id=sa" / /appSettings
几个命名空间
当用到DataSet时,用using system.Data.SqlClient...[ 查看全文 ]