Try something like this
private static bool Insert(List<loan> loanList)
{
bool Result = false;
SqlConnection db = new SqlConnection("connstringhere");
SqlTransaction transaction;
db.Open();
transaction = db.BeginTransaction();
try
{
foreach (Loan item in loanList)
{
new SqlCommand("INSERT INTO TransactionDemo " +
"( prsnlcd ,LoanCode,LoanStatus) VALUES ('"+item.prsnlcd+"','"+item.LoanCode+"','"+item.LoanStatus+"');", db, transaction)
.ExecuteNonQuery();
}
transaction.Commit();
Result = true;
}
catch (SqlException sqlError)
{
transaction.Rollback();
Result = false;
}
db.Close();
return Result;
}