c# how do i re-initialize qBuilder01 of type StringBuilder?

Posted on 2007-07-27
Last Modified: 2011-10-03
how do i re-initialize qBuilder01 of type StringBuilder?
 initially i declared StringBuilder qBuilder01 = new StringBuilder().
command.CommandText = qBuilder01.ToString();

i want to re-use qBuilder01after i am done with first query.

Question by:jgordin
    LVL 10

    Accepted Solution

    qBuilder01.Remove(0, qBuilder01.Length)

    Will remove everything from the builder and have it ready for more.
    LVL 2

    Assisted Solution

    qBuilder01.Length = 0

    Will clear the StringBuilder.

    LVL 96

    Assisted Solution

    by:Bob Learned
    Just create a new StringBuilder:

    qBuilder01 = new StringBuilder();


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
    The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now