我有这个代码:
using (SqlCeConnection sqlConn = new SqlCeConnection(@"Data Source=\my documents\\PlatypusDB.SDF"))
{
sqlConn.Open();
string dmlStr = "insert into platypus_settings (setting_name, setting_value) values(?, ?)";
SqlCeCommand cmd = new SqlCeCommand(dmlStr, sqlConn);
cmd.CommandType = CommandType.Text; //<-- necessary?
cmd.Parameters[0].Value = settingName;
cmd.Parameters[1].Value = settingVal;
try
{
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Platypus.ExceptionHandler(ex, "writeSettingsVal");
}
}
...但不知道是否需要注释行,是膨胀代码,还是两者都无关紧要?