public static int RowCount(DbConnection conn, IDataClient client, string tablename)
{
try
{
string sql = string.Format("select count(1) from {0}", tablename);
var cmd = client.GetCommand(sql, conn);
return Utilities.GetAs<int>(cmd.ExecuteScalar(), -1);
}
catch (Exception ex)
{
_log.Error("Error while looking for table", ex);
}
return -1;
}