Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
i sent this statement to sql:

SQL
insert into tableName (fieldName) values ('Jack's car')


in order to Save
But an error occurred

Thanks for any solution to the problem
Posted
Updated 26-Jul-15 20:00pm
v2
Comments
Maciej Los 27-Jul-15 2:01am    
What kind of error? What's a message?

1 solution

Probably, an error message is: "
Msg 105, Level 15, State 1, Line xxx
Unclosed quotation mark after the character string</pre>


To workaround it you have to add another '.

SQL
insert into tableName (fieldName) values ('Jack''s car')


As Afzaal[^] suggested, i need to warn you about SQL Injection[^].

More: How To: Protect From SQL Injection in ASP.NET[^]
SQL Injection and how to avoid it[^]
Do Stored Procedures Protect Against SQL Injection?[^]
SQL Injection Attacks[^]
 
Share this answer
 
v5
Comments
Afzaal Ahmad Zeeshan 27-Jul-15 2:16am    
Good, but wait. Forgot SQL Injection? Try providing him with a solution for parameterization. :-) That would help him in many ways. Hard-coded string would work in this context, in his application it won't. There he needs a variable data and which would be exposed to SQL Injection.
Maciej Los 27-Jul-15 2:20am    
Done ;) Thank you for your valuable comment.
Afzaal Ahmad Zeeshan 27-Jul-15 2:23am    
Have a 5. :-)
Maciej Los 27-Jul-15 2:31am    
Thank you ;)
CPallini 27-Jul-15 2:46am    
My 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900