locked
Update Field RRS feed

  • Question

  • User-1499457942 posted

    hi

      I want to update field with below text 

    'Apple',Banana'

    Thanks

    Wednesday, September 19, 2018 10:08 AM

Answers

  • User-1716253493 posted

    set field1 = '''Apple'',''Banana'''

    AFAIK simply use two single quotes to store single quote

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 20, 2018 1:51 AM

All replies

  • User753101303 posted

    Hi,

    Some more context could help especially as it seems you are quite experienced with so many posts?

    For now it almost seems like you are just starting to use db ? You could learn about "Entity Framework" whose purpose is to expose data as objects or ADO.NET if you prefer a lowel level API. For now it seems you are looking for the https://www.w3schools.com/sql/sql_update.asp statement :
    UPDATE YourTable SET YourColumn='Apple,Banana' WHERE Id=@value

    When  using a db and depending on the purpose rather than storing text with comma separated values you are storing each value on its own row making easier to query your data (for example finding all recipes using at least one ingredient found in another recipe or whatever).

    But may are you asking how to update a form file using JavaScript or C#. For now it's quite vague.

    Edit: as it is in a SQL Forum I assumed a db question but as you see it' hard to be 100% sure about your actual question

    Wednesday, September 19, 2018 10:46 AM
  • User-1716253493 posted

    set field1 = '''Apple'',''Banana'''

    AFAIK simply use two single quotes to store single quote

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 20, 2018 1:51 AM
  • User-893317190 posted

    Hi JagjitSingh ,

    It is no problem with update field only through c# .

    The problem I could think out is that using javascript funcation to update with the text as parameter. If so , you could use HttpUtility.JavaScriptStringEncode to encode your text if use javascript like below.The value of Text is  'Apple',Banana'.

      alert('<%=HttpUtility.JavaScriptStringEncode( Text) %>')
    

    Since you haven't posted what problem you have met with updating field with the text and the code you have problem with, it is hard to give your specific solution.

    Please provide more information .

    Best regards,

    Ackerly Xu

    Thursday, September 20, 2018 2:39 AM