SQL Insert value that contains apostrophe

Hi,
I am trying to insert a datatable into a SQL server DB table. I am getting error “Incorrect syntax near ‘,’.” What do you think the reason might be, because i am not writing a sql query, I am just inserting the whole datatable. I made sure, that both the table and datatable have similar columns.

Hey,
same issue here, any news?
Eduard.

Hey, in my case the reason was that I was trying to Insert empty Data table, If condition to check if data table has any values fixed the issue.
Good luck,
Eduard.

Hey, In my case, one of the column has special characters. I tried to save the error message in the column and the message has some special characters.

How did you replace them in a data table if you don´t mind mentioning?
Thanks
Eduard.

I found the solution in the below link. Escape the apostrophe (i.e. double-up the single quote character) in your SQL:

3 Likes