MySQL Connector appending the enum with the value one less than the actual one

前端 未结 2 662
走了就别回头了
走了就别回头了 2021-01-20 05:01

I\'m using the MySQL Connector for .NET to manage a MySQL database from C#.

When I try to insert an enum into the database it appends the enum with the value

2条回答
  •  粉色の甜心
    2021-01-20 05:21

    You could make your enum like this

    public enum MyEnum {
        FirstValue = 1, 
        SecondValue, 
        ThirdValue
    }
    

    It will start from 1 instead from 0.

提交回复
热议问题