ASP.NET single quotes

While we are inserting data into the database table we come across the messages like..

We are getting the above error message because there is a problem while inserting single quoted character using in sql statements. For ex: We want to insert a string like "net-informations's" , the system shows the above error messages, because we are trying to insert a single quoted character using in sql statement.

We can solve this issue by replace any single quote with two quotes like "net-informations''s" .

For avoiding each time adding another single quote to the string , here we implement a function to replace the string with two single quotes.



From the following program you can see how to handle single quotes in ASP.Net applications.


Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.vb (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About