If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Saving to the database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-29-04, 03:09
Thato Thato is offline
Registered User
 
Join Date: Jan 2004
Location: South Africa
Posts: 3
Angry Saving to the database

HI! Members

Please help! I need to get an amount from database, display it on a textbox and accept a number from the user. Subtract the user number from the amount in the textbox then put the answer back in that text box.

All that I have done, Now I need to save the new amount to the database and exit. My info is like this:

Database - MsAccess 2000
Name (Money) -- Table (Balances) -- Field (Curr_Bal)


I'm using ADO connection and I've tried putting the following code in the cmdSave button : 1. adBalances.fields("Curr_Bal")= text1.text
adBalances.Update
2. adBalances.recordset.update

I've tried these two seperately and I'm getting no response at all, I mean no errors. When I exit the program and run it again the amount from the database is still the same and I need the program to update the database everytime this transaction is perfomed.

Can someone please help.
Attached Images
File Type: jpg .jpg (6.9 KB, 109 views)
Reply With Quote
  #2 (permalink)  
Old 02-12-04, 14:13
rami.haddad rami.haddad is offline
Registered User
 
Join Date: Jan 2004
Posts: 184
Re: Saving to the database

To use the update property you must set the correct cursortype and cursorlocation as well as locktype. Try this control featured on download.com that I have been using that has made my life easier:

http://download.com.com/3000-2404-10...ml?tag=lst-0-1

After selecting the CursorType, CursorLocation, LockType and Disconnected status of your Recordset (there are defaults). I bind my controls and that is it All the complexities of ADO are hidden from the user which is you.

Then I can Navigate, Add New, Delete, Refresh, Search and Save Changes to my recordsets without any other code. That is really it, no other code is needed.

This works in any environment VB, Access, VC++ etc...

Let me know what you think.

Quote:
Originally posted by Thato
HI! Members

Please help! I need to get an amount from database, display it on a textbox and accept a number from the user. Subtract the user number from the amount in the textbox then put the answer back in that text box.

All that I have done, Now I need to save the new amount to the database and exit. My info is like this:

Database - MsAccess 2000
Name (Money) -- Table (Balances) -- Field (Curr_Bal)


I'm using ADO connection and I've tried putting the following code in the cmdSave button : 1. adBalances.fields("Curr_Bal")= text1.text
adBalances.Update
2. adBalances.recordset.update

I've tried these two seperately and I'm getting no response at all, I mean no errors. When I exit the program and run it again the amount from the database is still the same and I need the program to update the database everytime this transaction is perfomed.

Can someone please help.
Reply With Quote
  #3 (permalink)  
Old 02-13-04, 01:29
Thato Thato is offline
Registered User
 
Join Date: Jan 2004
Location: South Africa
Posts: 3
Re: Saving to the database

Hi! Rami

I have tried the syntax:

adoRS.recordset.fields("column_name") = text1.text
adoRS.recordset.update

It worked. however I have just downloaded the program you mentioned I will give it a try and will let you know how it went. I'm currently at work so I might take a while before I get back to you

Thanx for your response, I was begining to lose hope in this forum.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On