初始化字符串的格式不符合从索引 124 开始的规范

Format of the initialization string does not conform to specification starting at index 124

正在尝试使用 Visual Studio 2017 访问 SQL Server 2014 数据库;在每个 运行 上,它显示此错误

System.ArgumentException: Format of the initialization string does not conform to specification starting at index 124

阅读了一些关于堆栈溢出的问题,但它们属于其他上下文。像 asp.net 或 azure 数据库等

<configuration>
    <connectionStrings>
        <add name="EMPLOYES" 
             connectionString="Data Source=DESKTOP-0ROOGH3\SQLEXPRESS;Initial Catalog=EMPLOYES;Integrated Security = true;System.Dat.SqlClient"/>
    </connectionStrings>
</configuration>

代码:

private void button2_Click(object sender, EventArgs e)
{
    String conString = ConfigurationManager.ConnectionStrings["EMPLOYES"].ConnectionString;

    // here I get the exception
    SqlConnection conn = new SqlConnection(conString); 

    SqlCommand cmd = new SqlCommand("AddNewEmployee", conn);
    cmd.CommandType = CommandType.StoredProcedure;

    cmd.Parameters.Add("@EmployeeID", SqlDbType.NVarChar, 8).Value = EmpIDTextBox.Text;
    cmd.Parameters.Add("@FirstName", SqlDbType.NVarChar, 50).Value = FirstNameTextBox.Text;
    cmd.Parameters.Add("@LastNmae", SqlDbType.NVarChar, 50).Value = LastNameTextBox.Text;
    cmd.Parameters.Add("@Email", SqlDbType.NVarChar, 50).Value = EmailTextBox.Text;
    cmd.Parameters.Add("@Telephone", SqlDbType.NVarChar, 50).Value = TelephoneTextBox.Text;

    conn.Open();
    cmd.ExecuteNonQuery();
    conn.Close();

    MessageBox.Show("Employee is added successfully!");
}

我希望插入记录,但它产生了一些异常

您的连接字符串看起来完全乱码,请尝试

<configuration>
    <connectionStrings>

       <add name="EMPLOYES" 
            connectionString="Data Source=DESKTOP-0ROOGH3\SQLEXPRESS;Initial Catalog=EMPLOYES;Integrated Security = true;" 
            providerName="System.Data.SqlClient" />

    </connectionStrings>
</connectionStrings>

其他资源