You can try something like this:
suppose you have the following table columns in your database
1. Payment (of type interger)
1. PaymentDate (of type DateTime)
Now that i don't know how you are accessing your database, i will assume you are using Linq-Sql!
public Int32 CalculateMonthlyPayment( DateTime startDate, DateTime endDate )
{
Int32 totalPayments = DataContext.TableName.Where( t => t.PaymentDate >= startDate && t.PaymentDate <= endDate ).Sum( t => t.Payment );
return totalPayments;
}