本方法返回false仅在任何问题(无论其类型如何)的情况下。我想知道的意愿将using
声明打破了逻辑,如果异常来自USING语句的返回值
它是确定从using语句以这种方式返回真值:
try
{
Measurements.DeleteAllMeasurements(ID);
string query = "DELETE FROM `Narz` WHERE `NAZk_1_ID`[email protected]_ID";
using(OleDbConnection strukturaConnection = new OleDbConnection(CommonConnectionString + DbPath + strStructureMdb))
{
using (OleDbCommand command = new OleDbCommand(query, strukturaConnection);)
{
command.Parameters.Add("@NAZ_ID", OleDbType.Numeric, 50);
command.Parameters["@NAZ_ID"].Value = ID;
command.ExecuteNonQuery();
return true;
}
}
}
catch (Exception ex)
{
Logger.LogError(ex);
return false;
}
或者我应该返回另一个假办法?
**使用**不会以任何方式破坏您的代码。 –