StringBuilder query = new StringBuilder(); query.Append("SELECT * FROM customers WHERE id = "); query.AddFormattedParameterToQuery(123);
StringBuilder query = new StringBuilder(); query.Append("SELECT * FROM products WHERE price >= "); query.AddFormattedParameterToQuery(10.5, "0.00");In this example, the function is used to format a decimal value (10.5) with two decimal places and add it as a parameter to the query string. The package library for the StringBuilder class is part of the System.Text namespace, which is included in the .NET Framework.