StringBuilder query = new StringBuilder("SELECT * FROM users WHERE username = "); query.AddParameterToQuery("JohnDoe");
StringBuilder query = new StringBuilder("SELECT * FROM customers WHERE age > "); query.AddParameterToQuery(18); query.Append(" AND country = "); query.AddParameterToQuery("USA");This example creates a StringBuilder object with a more complex SQL query that has two parameters added to it. The StringBuilder object uses both methods Append and AddParameterToQuery to concatenate the correct syntax for the SQL query. The resulting SQL query would be "SELECT * FROM customers WHERE age > 18 AND country = 'USA'". The package library for the StringBuilder class is included in the .NET Framework Library. No external package installation is required.