473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Microsoft Access/C# transfer problem

5
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:

Expand|Select|Wrap|Line Numbers
  1. objOleDbConnection.Open();
  2.  
  3.             OleDbDataReader objReader = objSelectAccount.ExecuteReader();
  4.  
  5.             while (objReader.Read()) 
  6.             {
  7.                 cmbAccountTransfer.Items.Add(objReader["Account Number"]);
  8.             }
  9.             objOleDbConnection.Close();
  10.  
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:
Expand|Select|Wrap|Line Numbers
  1. private void TransferAccountInformation() 
  2.         {
  3.  
  4.         objSelectAccountData.Parameters["Account Number"].Value = cmbAccountTransfer.SelectedItem;
  5.  
  6.             objOleDbConnection.Open();
  7.  
  8.             OleDbDataReader objReader = objSelectAccountData.ExecuteReader();
  9.             objReader.Read();
  10.             m_decBalanceTransfer = Convert.ToDecimal(objReader["Balance Amount"]);
  11.             objReader.Close();
  12.             objOleDbConnection.Close();
  13.         }
  14.  
This is the code for the whole transfer function:
Expand|Select|Wrap|Line Numbers
  1. private void TransferAccountInformation() 
  2.         {
  3.  
  4.         objSelectAccountData.Parameters["Account Number"].Value = cmbAccountTransfer.SelectedItem;
  5.  
  6.             objOleDbConnection.Open();
  7.  
  8.             OleDbDataReader objReader = objSelectAccountData.ExecuteReader();
  9.             objReader.Read();
  10.             m_decBalanceTransfer = Convert.ToDecimal(objReader["Balance Amount"]);
  11.             objReader.Close();
  12.             objOleDbConnection.Close();
  13.         }
  14.  
Part of the code that is activated when OK button is pressed:

case "Transfer":

txtPin.PasswordChar = '\0';
Transfer(Convert.ToDecimal(txtTransfer.Text));
txtTransfer.Clear();
m_strAction = "NoAction";
TransferAccountInformation();
break;

And finally code which is supposed to update the balance on both accounts:

Expand|Select|Wrap|Line Numbers
  1. private void UpdateBalance() 
  2.         {
  3.             objUpdateBalance.Parameters["Balance Amount"].Value = m_decBalance;
  4.             objUpdateBalance.Parameters["Balance Amount"].Value = m_decBalanceTransfer;
  5.             objUpdateBalance.Parameters["Original_Account Number"].Value = cmbAccountNumbers.SelectedItem;
  6.  
  7.             objOleDbConnection.Open();
  8.             objUpdateBalance.ExecuteNonQuery();
  9.             objOleDbConnection.Close();
  10.         }
  11.  
Really sorry for extremely long thread .. any ideas?
Apr 23 '09 #1
0 1628

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
32
by: Lyle Fairfield | last post by:
1. Will your next operating system be Windows? 2. Will your next browser be Internet Explorer? 3. Will your next office suite be MS Office XXXX? 4. Will your next e-mail client be Outlook or...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed...
2
by: Abubakar | last post by:
Hello , I just finished developing a program using Microsoft Desktop Engine with C# as the front end. Everything is okay on my system. But, on trying to deploy it on a different system it gives an...
0
by: techie | last post by:
I have created an event sink in my ATL COM project. The event sink receives events from a C# component. There is no problem with receiving events but when my COM object is released I get an...
20
by: TC | last post by:
I need an automated procedure to copy data from an Access table to a SQL Server table. Speed is important. What is the recommended technique? I can export the data from Access, copy it via FTP,...
2
by: rajaaryan44 | last post by:
how can we transfer data from one access database to another databse . the table name is same for both the database . in one table some records are there (rs say e.g.) now another table has say rs+10...
0
by: rajvbprogramer | last post by:
hello friends can u help me with this problem . i needed it urgently. i first used DAO then some told me to do ADO. now i m stuck. now i dont know what to do.. my problem is to compare two...
1
by: AccessHunter | last post by:
Hi, Please help. I am not sure if this is the right place to post this question. I was given a database that was created by a person who no longer works here.I am trying to inherit the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.