我一直在尝试找回贷款金额并希望它是浮动的。但是,loanAmount 返回值 0.0。顺便说一句,sql 语句只返回一个值。请帮忙?
SqlCommand cmd5 = new SqlCommand();
cmd4.Connection = conn;
cmd4.CommandText = "SELECT loanAmount FROM LoanPortfolio WHERE custID='" + custIDs + "' AND loanType LIKE 'Personal Loan'";
conn.Open();
float loanAmount = 0.0F;
SqlDataReader amountLoan = cmd4.ExecuteReader();
while (amountLoan.Read())
{
loanAmount = float.Parse(amountLoan.ToString());
break;
}
conn.Close();