473,406 Members | 2,549 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.

Statements working with ADO data control and results

10
Been working on some programming exercises in my spare time and don't fully understand this one related to ADO....Appreciate any help on this.

The name of the ADO data control is adoNum-----Was trying to figure which one of these statements would multiply the contents of the fldNum1 field by 3 and then store the result in the fldTot field?



adoNum.Fields(fldTot) = adoNum.Fields(fldNum1) * 3

adoNum.Fields("fldTot") = adoNum.Fields("fldNum1") * 3

adoNum.Recordset.Fields(fldTot) = adoNum.Recordset.Fields(fldNum1) * 3

adoNum.Recordset.Fields("fldTot") = adoNum.Recordset.Fields("fldNum1") * 3
Apr 1 '08 #1
1 1313
jeffstl
432 Expert 256MB
Been working on some programming exercises in my spare time and don't fully understand this one related to ADO....Appreciate any help on this.

The name of the ADO data control is adoNum-----Was trying to figure which one of these statements would multiply the contents of the fldNum1 field by 3 and then store the result in the fldTot field?



adoNum.Fields(fldTot) = adoNum.Fields(fldNum1) * 3

adoNum.Fields("fldTot") = adoNum.Fields("fldNum1") * 3

adoNum.Recordset.Fields(fldTot) = adoNum.Recordset.Fields(fldNum1) * 3

adoNum.Recordset.Fields("fldTot") = adoNum.Recordset.Fields("fldNum1") * 3
OK, Im not quite sure what your adoNum is defined as. I assume it is a recordset though the way you have it displayed here.

That being the case this line would be your best bet I suppose

adoNum.Fields("fldTot") = adoNum.Fields("fldNum1") * 3

Though I would recommend setting your entire recordset into variables before manipulating, especially if the data types are not set in the tables to integers
Expand|Select|Wrap|Line Numbers
  1. dim TotalNum as Integer
  2. dim FieldNum as Integer
  3. FieldNum = adoNum.Fields("fldNum1") 
  4. TotalNum = FieldNum * 3
  5. adoNum.Fields("fldTot") = TotalNum
  6. adoNum.Update
  7.  
However, you have to still perform an update on your recordset once your field values are set, assuming you are "on" the right record in your code.

Expand|Select|Wrap|Line Numbers
  1. adoNum.Update
  2.  
Apr 2 '08 #2

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

Similar topics

11
by: dmbkiwi | last post by:
I am new to this group, and relatively new to python programming, however, have encountered a problem I just cannot solve through reading the documentation, and searching this group on google. I...
1
by: Tom D | last post by:
I'm rewriting a database interface that our company currently has. Currently it's using the Pear::DB interface, but we found that that was introducing a bit too much overhead. I'm rewriting the...
4
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from...
2
by: misschristalee | last post by:
I'm having a brain blockage day.... Scenario: Search Form with 6 text boxes Query has same six fields Each has this IIF: IIf(IsNull(!!),"",!!) with each dictating the correct text box of...
0
by: Wesman | last post by:
Why does the following code not work (displays the correct values in the second textbox). if i chane the OnFocusChange method to the following it will work: private void OnFocusChange(object...
34
by: Jeff | last post by:
For years I have been using VBA extensively for updating data to tables after processing. By this I mean if I had to do some intensive processing that resulted in data in temp tables, I would have...
2
by: ojorus | last post by:
Hi! Some questions regarding the mysqli-extension (php5) 1) Prepared statements: If I understand things right, prepared statements will give better performance if you make several similar...
12
by: Jerim79 | last post by:
I have created a verification script to verify information and redirect the customer to the appropriate error page. For example: if ($FName=""){ header('Location:/verify_fname.htm'); } else{...
8
by: =?Utf-8?B?UGFvbG8=?= | last post by:
Is there any way I can avoid the ugly and repetitive 'if' construct shown below? I can't refactor into a separate method because qryTrans is an anonymous type. I don't think I can use a switch...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.