.net 6 core mysql tinyint value 2,3

 
Add to connection string

TreatTinyAsBoolean=false

To add the `TreatTinyAsBoolean` option to the connection string in MySQL, you typically include it as a parameter within the connection string. Here's how you can do it:

```csharp
string connectionString = "Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;TreatTinyAsBoolean=true;";
```

Replace `myServerAddress`, `myDataBase`, `myUsername`, and `myPassword` with the appropriate values for your MySQL server configuration.

Make sure to set `TreatTinyAsBoolean` to `true` or `false` based on your requirements. Setting it to `true` will treat `TINYINT(1)` columns as boolean values (`true` for 1 and `false` for 0). If set to `false`, `TINYINT(1)` columns will be treated as integers. 

Including this parameter in your connection string will configure the MySQL Connector/NET to handle `TINYINT(1)` columns accordingly.

No need set anything.





留言

這個網誌中的熱門文章

香港袐密行動

要老是忘記, 我更記不起