我正在尝试向表中添加一些浮点值。使用 Sqlite 更新命令
float Cu= row.Cells["Cu"].Value != null && float.TryParse(row.Cells["Cu"].Value.ToString(), out Cu) ? Cu: 0;
所以在这里我确保行中的值不为空并且也是浮动的。如果为真,则插入该值,否则插入 0。
Sqlite Update command
insCmdVesselData.Parameters.AddWithValue("@Copper",Cu);
public string SQL_updateVesselData = @"UPDATE
[VesselData]
SET
[Copper]=@Copper,
[Nickel]=@Nickel,
[Phosphorous]=@Phosphorous,
[Silicon]=@Silicon,
[Manganese]=@Manganese,
where
[PlantId] = @PlantId and FileId= @FileId
Here Copper,Nickel is a Numeric in the Database.
Suppose my value of Cu=0.07, during this update, it is adding a number 0.0700000002980232. it the value is 0.5, it updates with 0.529999971389771. Not sure y its adding all these garbage at the end
谢谢你孙