0

i got the error while running the following query on Visual studio 2019

$"INSERT INTO DB_NEWS.ARTICLES(ID,SOURCE_ID,SOURCE_NAME,AUTHOR,TITLE,DISCRIPTION,URL,URLTOIMAGE,PUBLISHED_AT,CONTENT) VALUES ({id},'{article.source.id}','{article.source.name}','{article.author}','{article.title}','{article.description}','{article.url}','{article.urltoimage}',{article.publishedAt},'{article.content}');";
DiplomacyNotWar
  • 31,605
  • 6
  • 57
  • 75
  • 1
    Realistically, one of your values probably has a `'` in it, which is breaking everything. You should use parameterized queries instead. – DiplomacyNotWar Mar 25 '21 at 09:15
  • I too thought of the same , but it doesn"t have ' in it – tauseef shahid Mar 25 '21 at 11:47
  • I suggest changing it to a parameterized query (you should do this anyway - it prevents sql injection and provides other benefits). If your query still doesn't work, create a new question with the query and command code, and the error. – DiplomacyNotWar Mar 25 '21 at 15:53

0 Answers0