SQLHELPER
I want to use stringbuilder in SQL Helper class, how can I use that?
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pradeep ShetRank #595 · 4K reputationPosted Feb 13, 2015, 9:24 AM EST
You need to Import a namespace.
using System.Text;
Munesh SharmaRank #174 · 13.9K reputationPosted Feb 13, 2015, 9:09 PM EST
Rajeev KumarRank #1,334 · 1.3K reputationPosted Mar 16, 2023, 6:17 AM EDT
StringBuilder class is defined in the System.Text namespace. You must either import this namespace in your class or reference it directly in the object instantiation.
using System.Text;
Tuhin PaulRank #7 · 71.9K reputationPosted Mar 16, 2023, 10:34 AM EDT
It is not recommended to use StringBuilder in a SQL Helper class because it is vulnerable to SQL injection attacks. Instead, it is best to use parameterized queries to ensure the security and integrity of the database.
Tuhin PaulRank #7 · 71.9K reputationPosted Mar 16, 2023, 10:35 AM EDT
Remember to sanitize and validate any input parameters before appending them to the SQL query string to prevent SQL injection attacks.