Hi, im doing a college project, which is a banking app, it is more or less fully functioning, the user can log in and check their balance, but i have trouble setting up a transfer function, so the user can transfer money from their account to the chosen account. I am using access though JET for it. My efforts thus far have only got it to change the balance on the primary account. This is my open connection code which is activated when the user clicks on transfer button:
so when the account is chose in the combo box, it open the connection for that particular account, this is the code the retrieves all the data for the account:
This is the code for the whole transfer function:
Part of the code that is activated when OK button is pressed:
case "Transfer":
txtPin.Password Char = '\0';
Transfer(Conver t.ToDecimal(txt Transfer.Text)) ;
txtTransfer.Cle ar();
m_strAction = "NoAction";
TransferAccount Information();
break;
And finally code which is supposed to update the balance on both accounts:
Really sorry for extremely long thread .. any ideas?
Code:
objOleDbConnection.Open();
OleDbDataReader objReader = objSelectAccount.ExecuteReader();
while (objReader.Read())
{
cmbAccountTransfer.Items.Add(objReader["Account Number"]);
}
objOleDbConnection.Close();
Code:
private void TransferAccountInformation()
{
objSelectAccountData.Parameters["Account Number"].Value = cmbAccountTransfer.SelectedItem;
objOleDbConnection.Open();
OleDbDataReader objReader = objSelectAccountData.ExecuteReader();
objReader.Read();
m_decBalanceTransfer = Convert.ToDecimal(objReader["Balance Amount"]);
objReader.Close();
objOleDbConnection.Close();
}
Code:
private void TransferAccountInformation()
{
objSelectAccountData.Parameters["Account Number"].Value = cmbAccountTransfer.SelectedItem;
objOleDbConnection.Open();
OleDbDataReader objReader = objSelectAccountData.ExecuteReader();
objReader.Read();
m_decBalanceTransfer = Convert.ToDecimal(objReader["Balance Amount"]);
objReader.Close();
objOleDbConnection.Close();
}
case "Transfer":
txtPin.Password Char = '\0';
Transfer(Conver t.ToDecimal(txt Transfer.Text)) ;
txtTransfer.Cle ar();
m_strAction = "NoAction";
TransferAccount Information();
break;
And finally code which is supposed to update the balance on both accounts:
Code:
private void UpdateBalance()
{
objUpdateBalance.Parameters["Balance Amount"].Value = m_decBalance;
objUpdateBalance.Parameters["Balance Amount"].Value = m_decBalanceTransfer;
objUpdateBalance.Parameters["Original_Account Number"].Value = cmbAccountNumbers.SelectedItem;
objOleDbConnection.Open();
objUpdateBalance.ExecuteNonQuery();
objOleDbConnection.Close();
}