我想将连接字符串作为键。所以我在 web.config 中写了这段代码。
<add key="connectstring" value="Data Source=USER-PC;Initial Catalog=DBName; Integrated Security=False; providerName=System.Data.SqlClient"/>
</appSettings>
但有错误,它说
Keyword not supported: 'providername'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Keyword not supported: 'providername'.
Source Error:
Line 28: SqlConnection conn;
Line 29: conn = new SqlConnection(ConfigurationManager.AppSettings["connectstring"].ToString());
Line 30:
Line 31:
我该如何解决?