1

Possible Duplicate:
How to fix “Incorrect string value” errors?

I'm retrieving data from my database through a webpage, changing the data, and then trying to store it back to the database, but it is giving me an error during save.

I have tried to change the collation of my database (latin1 default and utf8 default) to see if that would make a difference. But sadly it didn't.

Here is the error I am getting:

500

error

MySql.Data.MySqlClient.MySqlException (0x80004005): Incorrect string value: '\xC2\x92m as...' for column 'description' at row 1
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId)
   at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int32& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at BlueSEQ.SQL.Execute(MySqlCommand Command) in ***:line 798
Community
  • 1
  • 1
  • you need to show some code/SQL/param values... – Yahia Aug 12 '11 at 16:07
  • This is a snippet from the code i am trying to insert. "6-94). I'’m assuming I" Without quotes. I suspect it to be the I'’m that is breaking it. – Mads T. Carstensen Aug 12 '11 at 16:22
  • that depends... since you didn't the code for the SQL/Command etc. I need to ask: are you using parameterizd queries ? or are you building the string for SQL directly in code ? – Yahia Aug 12 '11 at 16:29
  • I am using parameterized querries. – Mads T. Carstensen Aug 12 '11 at 16:39
  • THEN the " within a string should never cause any problem... – Yahia Aug 12 '11 at 16:45
  • Yes, i would believe so too, but somehow it does anyway and i can't figure out why or how. – Mads T. Carstensen Aug 12 '11 at 16:48
  • please show the code for the sql command and the parameters, and: which MySQL client/provider are you using ? – Yahia Aug 12 '11 at 16:49
  • I can't show you my code because the ORM system we have developed which dynamically creates the sql commands for us. We are using MySQL connector .NET v6.2.3.0 – Mads T. Carstensen Aug 12 '11 at 16:59
  • the problem can't be solved without seeing the actual SQL the ORM generates in this case... – Yahia Aug 12 '11 at 17:01
  • there is most probably either a bug in the ORM or in how the ORM is used in this case... IF the bug is not in the ORM then you should a different client (for example from Devart) – Yahia Aug 12 '11 at 17:03
  • I am sorry, I just can't show you the code even tho i would. We are still checking into the ORM to see if there is anythhing there. But what is strange is that we got about 200 rows of data wich does not cause any problems at all. Only that specific row with those strange characters. I even tried to manually go into the database and delete from the m in I'’m and back to the . and while i deleted there was some strange white spaces which it did not show which i deleted. When they were deleted the specific problem was solved. But as of now i must assume that it could still happen again. – Mads T. Carstensen Aug 12 '11 at 17:09
  • never mind, it is just impossible to help in this case without the code... so all I can do is wish you the very best in finding the cause for this problem... – Yahia Aug 12 '11 at 17:14

0 Answers0