How to resolve SqlConnection error “Keyword not supported: 'decr pool size'.”

I am creating Windows Application and using System.Data.SqlClient.SqlConnection object

 SqlConnection targetDatabaseConnection = new SqlConnection(ConnectionString);

Following is the connection string

  • Use Boolean algebra in tsql to avoid CASE statement or deal complex WHERE conditions
  • MDX query: How to compare year to date figures from the current year with year to date figures from the previous year?
  • SQL Server 2014 - Multiple SUM/COUNT with subqueries
  • How to dynamically change the index value with SQL DML
  • Timeout issue in Backup-SQLDatabase cmdlet
  • C# - how to filter the DataGridView using ComboBox
  • Data Source=.;Initial Catalog=TestBCP_12;User ID=sa;Password=sa;Min Pool Size=100; Max Pool Size=100; Decr Pool Size=100; Incr Pool Size=100;
    

    Getting error with the following two settings

     Decr Pool Size=100; Incr Pool Size=100;
    

    I know all the sizes are 100 , is it the cause of exception if yes? , the message is not reverent to the error .

    I read the following article and implemented based on it
    http://www.codeproject.com/Articles/17768/ADO-NET-Connection-Pooling-at-a-Glance

    Found the answer that this is not possible in SQL directly so asked new question
    How to achieve functionlity i.e. controlling "Incr Pool Size" or "Decr Pool Size" while establishing connection to SQL? similar to ORACLE
    to find other possible ways to achieve it.

  • TSQL error in .Net but not in SSMS
  • TransactionScope helper that exhausts connection pool without fail - help?
  • Stored procedure output parameter asp.net c#
  • compare databases (tables only) using C# and Ado.net
  • ADO.NET - SQL bit value “1” still being read as “false” by DataReader
  • How do I get the SqlDbType of a column in a table using ADO.NET?
  • 3 Solutions collect form web for “How to resolve SqlConnection error “Keyword not supported: 'decr pool size'.””

    Since you are using SqlConnection, it does not support Decr Pool Size or Incr Pool Size. This property is supported with OracleConnection

    You may check this article: Connection Pooling in DotNet

    From the article:

    You should refer to the documentation if you’re using a .NET Data
    Provider other than SQL Server. Other data providers may have more
    pooling options. A good example is the Oracle Data Provider, which
    offers two options — Decr Pool Size and Incr Pool Size — for
    controlling how a connection pool may shrink or grow.

    The list of accepted keywords is documented on MSDN. Neither Decr Pool Size nor Incr Pool Size are listed there.

    You Are using a syntax for Oracle connection strings against a SqlServer database.

    DECR POOL SIZE and INCR POOL SIZE are not supported in SqlServer connections.

    Simply remove these two parts from your connection.
    Also I suggest to remove the Max Pool Size=100; since this is the default value.
    The Min Pool Size=100; could also be removed if there is no special requirement to have an initial minimum size

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.