I am trying to insert a wild card character (‘) in sql database, but error is coming that
STRING IS TRUNCATED.
Text1.text="D'John Is Writing Dev's Books"
Here there are 2 wild characters (‘) in the text. When i try to insert this text in database, the problem is comming. The whole string should be inserted as it is, as well as to be retrieved as it is.
I am writing CMD=new sqlcommand("insert into tablename values('"& Text1.text &"')",con)
Please don’t use the double apostrophe answer. It’s the wrong way to go about this. Use query parameters instead, like this:
The other thing that puzzles me is that you say you are using access, but you have an SqlCommand object. An SqlCommand only talks to Sql Server. Access needs either the OleDb or Odbc providers, which would use an OleDbCommand or OdbcCommand respectively, as well as a different parameter placeholder.