I use BLToolkit with mysql and when I try to insert a record to a table, I am getting a query like this:
INSERT INTO `P`
(
`Name`
)
VALUES
(
\0Name
);
As you can see, this not the best mysql query.
Classes:
public class P
{
[PrimaryKey]
[Identity]
public int? ID { get; set; }
public string Name { get; set; }
}
The code for inserting:
var p = new P();
p.Name = "asdf";
p.ID = (int) db.InsertWithIdentity(p);
Do you know, what is going on?
I have gone through all the BLToolkit code, and do you know what I found??
The bug was in my MySqlDataProvider, I used an old version...
Here is correct: https://github.com/igor-tkachev/bltoolkit/blob/master/Source/Data/DataProvider/MySqlDataProvider.cs
My error is here:
I haven't set the
MySqlSqlProvider.ParameterSymbolproperty, my code just stored the value locally...