(int) faultsGroup 为 0 或 1,但我总是收到此错误:列 'FaultGroup' 不能为空
有人告诉我为什么吗?语法看起来不错。
MySqlCommand cmdAdd = new MySqlCommand("INSERT INTO Faults (" +
" FaultGroup, Text, Date, IP" +
") VALUES (" +
" @FaultGroup, @Text, @Date, @IP" +
")", conn);
MySqlParameter paramFaultGroup = new MySqlParameter("@FaultGroup", MySqlDbType.Int32);
FaultsGroup faultsGroup = (FaultsGroup) Enum.Parse(typeof (FaultsGroup), myFault.FaultGroup);
paramFaultGroup.Value = (int) faultsGroup;
cmdAdd.Parameters.Add(paramFaultGroup);
cmdAdd.ExecuteNonQuery();