I have this code, which I use all over my applications to save data back to the database.
public bool SaveDemo()
{
bool success = false;
try
{
using (DataTable dt = DataAccess.ExecuteDataTable("[dbo].[udp_Customers_ups]",
DataAccess.Parameter(CustomerIdColumn, CustomerId),
DataAccess.Parameter(CodeColumn, Code),
DataAccess.Parameter(CompanyColumn, Company),
DataAccess.Parameter(IsDeletedColumn, IsDeleted),
DataAccess.Parameter(LastUpdatedColumn, LastUpdated),
DataAccess.Parameter(UpdatedByColumn, UpdatedBy)))
success = true;
}
catch
{
success = false;
}
return success;
}
The code works as is, which by that I mean it saves the data back to the database. However CodeRush complains about the dt being an Unused Declaration. And since the Using is (I think) using the dt I would think that the warning is a false positive. So I am left wondering if CodeRush is wrong or if I am missing something?