Hello Friends,

I have an ASP.NET application and SQL Server as its DB. When the database was small everything was fine, as now the DB contains huge amount of data. It seems it skip out some calculation.
The details-

Application: It calculates the commission of particular agent (like affiliate) for self and its chain (Upline).

Front End: ASP.Net / C#
DB: MS SQL Server 2005
Server: Windows 2003 Shared Server (Web Hosting service taken from 3rd party)

Problem: Skip calculation specially in case of chain commission. Not for all, only few.

So, please suggest me a solution. Is this is because of it has been hosted on shared server? or what ever the reason behind this, please help me out.

Thanks,
Umesh Sinha

Dani AI

Generated

Practical, low-risk checklist to find why only some chain commissions are skipped (context: ASP.NET/C#, SQL Server 2005, shared hosting). symptom — “only a few” chain cases fail — usually points to edge-case data, timeouts, or race conditions rather than a blanket platform bug. is correct that more detail helps; ’s idea to push the core logic into the database is sensible for atomicity. The steps below are focused, reproducible, and safe to run on a copy of production.

Common causes to check and quick diagnostics:

  • Data integrity: look for orphaned/missing upline rows or unexpected NULLs. A simple pattern to compare expected vs applied commissions helps locate failures quickly.
-- find sales where applied commissions are lower than expected
SELECT s.Id, s.ExpectedCommission, ISNULL(c.TotalApplied,0) AS TotalApplied
FROM Sales s
LEFT JOIN (
  SELECT SaleId, SUM(Amount) AS TotalApplied FROM Commissions GROUP BY SaleId
) c ON c.SaleId = s.Id
WHERE ISNULL(c.TotalApplied,0) < s.ExpectedCommission;
  • Timeouts/partial runs: check ADO.NET CommandTimeout (default 30s) and ASP.NET executionTimeout; shared hosts may recycle long requests.
  • Numeric/NULL handling: verify column precision/scale (decimal), data truncation, and that NULLs/defaults won’t skip steps.
  • Concurrency: ensure updates are transactional or idempotent to avoid lost updates under load.

Concrete fixes and workflows:

  • Reproduce a failing SaleId in SSMS by calling the same proc/logic used by the app. Add a request/transaction id and deterministic logs at each step (read, compute, write).
  • If moving logic to a stored procedure, wrap work in a single transaction, use TRY/CATCH with explicit error logging, and return meaningful error codes.
  • Convert heavy recalculations to background batches with pagination and retry/compensation logic rather than long web requests.

Operational follow-up: add a scheduled discrepancy check (the example query), keep an audit entry per processed sale, and add unit/integration tests that cover missing-upline and NULL-edge cases. These steps localize the problem and make fixes safe to deploy.

Recommended Answers

All 2 Replies

Umesh, you have to give us way more information to be able to even start helping you. Please keep in mind that none of us have the slightest idea on your work, code, or calculation for that matter.

Hi,

I don't think that the issue occurs due to the server setup and hosting. Because you are saying that the chain commission calculation is skipped only for few cases.

The code may not be handling all the scenarios to perform the calculation.

Where do you handle the calculation? In the server side (C#) or database side through stored procedure?

If the logic is written in C#, It would be better to handle the calculation in the stored procedure.

Also ensure that exception handling is done well and error message are logged/displayed properly in the code.

You can try to log some messages into a text file/database table in each stage of calculation so that you could identify whether which portion of code is not reached.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.