StringBuilder Error

Posted on 2012-08-28
Last Modified: 2012-09-21
Can somebody please help me with this?  I get red squiggly lines in the second sb.Append.
SqlConnection conn = new SqlConnection();
        conn.ConnectionString = ConfigurationManager.ConnectionStrings["upscale"].ConnectionString;


        System.Text.StringBuilder sb = new System.Text.StringBuilder(50);
        sb.Append("INSERT INTO tblConsigner(fname,lname,email,phone");
        sb.Append("VALUES("+ @FULL_NAME +"," + @EMAIL +"," + @PHONE +"," + @MESSAGES +")";

Open in new window

Question by:Isaac
    LVL 74

    Accepted Solution

    I believe this would fix the issue:


    Open in new window

    LVL 69

    Expert Comment

    by:Éric Moreau
    you are missing your closing )
    LVL 12

    Expert Comment

    It should be
    sb.Append("VALUES("+ @FULL_NAME +"," + @EMAIL +"," + @PHONE +"," + @MESSAGES +")");

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

    737 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

    21 Experts available now in Live!

    Get 1:1 Help Now