locked
How to save single ( ' ) in sql server 2008 using class RRS feed

  • Question

  • User-712926555 posted

    Hi,

    I have add a values in list

    List<String> ColumnValues = new List<String>();
                ColumnValues.Add("'" + Name + "'");
                ColumnValues.Add(Status.ToString());
                ColumnValues.Add("'" + CreatedOn + "'");
                ColumnValues.Add("'" + UpdatedOn + "'");

    I am trying to "\"" insted of "'" but it shows an error. 

    Wednesday, September 16, 2015 3:05 AM

Answers

  • User603616845 posted

    Hi,

    If you want to add double quotes than use like this.

    ColumnValues.Add("\"" + CreatedOn + "\"");
    ColumnValues.Add("\"" + Name + "\"");

    for single quotes

      ColumnValues.Add("'" + UpdatedOn + "'");

    without any quotes.

         ColumnValues.Add(UpdatedOn.ToString());

    Hope this will help you.

    thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 16, 2015 4:30 AM

All replies

  • User571301025 posted

    In your above code in which line you got the error?

    Wednesday, September 16, 2015 3:22 AM
  • User-712926555 posted

    How to add double code insted of "'"

    Wednesday, September 16, 2015 3:39 AM
  • User603616845 posted

    Hi,

    I didn't get what you want. should your column value like this 'value' or "value" or value. Please specify it.

    thanks

    Wednesday, September 16, 2015 4:26 AM
  • User603616845 posted

    Hi,

    If you want to add double quotes than use like this.

    ColumnValues.Add("\"" + CreatedOn + "\"");
    ColumnValues.Add("\"" + Name + "\"");

    for single quotes

      ColumnValues.Add("'" + UpdatedOn + "'");

    without any quotes.

         ColumnValues.Add(UpdatedOn.ToString());

    Hope this will help you.

    thanks

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 16, 2015 4:30 AM