locked
Is there any mistakes in my queries(Insert & Delete) RRS feed

  • Question

  • User1156251743 posted

    Plz Help mee

    Sunday, July 22, 2012 6:40 AM

Answers

  • User-661350001 posted

    1) ("Insert into " +s2 + " values( '"+s1+ " ');",cn);

    2) ("Insert into " +s1 + " (topic_name) values( '"+s2+ " ');",cn);

    3) ("delete from " + s1+ "  where topic_name= '" + s2 + "'",cn);

    4)  ("delete from " + s1+ "  where topic_name= '" + s2 + "'",cn);

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 22, 2012 6:49 AM
  • User1648350404 posted

    For SQL Server, Use single quote before and after values

    OleDbCommand cmd2 = new  OleDbCommand("insert into "+ s1+ " (topic_name) values ('" + s2 + "')",cn);

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 22, 2012 6:51 AM

All replies

  • User-661350001 posted

    1) ("Insert into " +s2 + " values( '"+s1+ " ');",cn);

    2) ("Insert into " +s1 + " (topic_name) values( '"+s2+ " ');",cn);

    3) ("delete from " + s1+ "  where topic_name= '" + s2 + "'",cn);

    4)  ("delete from " + s1+ "  where topic_name= '" + s2 + "'",cn);

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 22, 2012 6:49 AM
  • User1648350404 posted

    For SQL Server, Use single quote before and after values

    OleDbCommand cmd2 = new  OleDbCommand("insert into "+ s1+ " (topic_name) values ('" + s2 + "')",cn);

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 22, 2012 6:51 AM
  • User1156251743 posted

    thank you

    Sunday, July 22, 2012 7:16 AM
  • User1156251743 posted

    thank you....:-)

    Monday, July 23, 2012 9:57 AM