0

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?

maxkoryukov
  • 4,205
  • 5
  • 33
  • 54

1 Answers1

0

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:

public static char ParameterSymbol
{
    get { return MySqlSqlProvider.ParameterSymbol;  }
    set { MySqlSqlProvider.ParameterSymbol = value; }
}

I haven't set the MySqlSqlProvider.ParameterSymbol property, my code just stored the value locally...

maxkoryukov
  • 4,205
  • 5
  • 33
  • 54