Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 2nd, 2007, 09:31 AM
Phoenix_riser Phoenix_riser is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 225 Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level)Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level)Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level)Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level)Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 2 h 28 m 15 sec
Reputation Power: 15
Loop through fields

I have two tables I need to combine and move into one main table. But each time I need to run a 'tidy' program on each field.

I might also need to change the fields on occasion. I therefor wanted to add a loop in and change in to the field name for a .edit where the orderID (the only thing linking the two tables) was present.

I have tried .fields(1) then looping to make 1 to 2 etc..
e.g. .fields(vLoop) with vLoop = vLoop + 1 each time.

However the fields in the tables are not aligned so this would not work. I've tried selecting out each field name from a seperate database;

strSQLRSCSVField = "SELECT * FROM Tb_Move Where CSVField = 1 ORDER BY ID Desc;"

then looping throught but the variable does not seem to work, as I can get it to do in ASP3 (doing in VB6 as most of cvoce can be recycled from an earlier project)

So I would put the next line of code in a loop and change the name each time, ok it means opening and closing the loop alot but for now it's simpler and alot less code!!

.Fields(vName) = vSelected

to work?

Reply With Quote
  #2  
Old April 5th, 2007, 09:00 PM
Leslie's Avatar
Leslie Leslie is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Honolulu
Posts: 184 Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 29 m 2 sec
Reputation Power: 9
I don't think there is an emoticon for "blank stare" but that's what I find myself doing after reading this post like four times. (Huh?)

I'd like to help but I'm not even certain you asked a question ... so with that said, if you DO need help, wanna try to explain the problem again a ... different way?

I got that you have two tables. You need to combine them. And you want to run a tidy routine on them. Than I lose you. I know it makes perfect sense to you but we don't know what you mean by at least half of that because we can't see inside your head

Try explaining the problem verbally as though you are talking to someone who doesn't know about programming or loops ...

Reply With Quote
  #3  
Old April 9th, 2007, 12:00 PM
Phoenix_riser Phoenix_riser is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 225 Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level)Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level)Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level)Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level)Phoenix_riser User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 2 h 28 m 15 sec
Reputation Power: 15
[QUOTE=Leslie]
I got that you have two tables. You need to combine them. And you want to run a tidy routine on them. [QUOTE]

I did but doing it a simpler way. When I am merging my data a tempory table is created with all the orderID references in. This is then reference for which items need to be tidied.

Rather than hundreds of lines of code it goes to a table called tb_tidy and it has a column with all the field names in. It then loops though editing them, ok it opens and closes the database alot this way but it works right.

Keeps it short and sweat. Only 1000 records a day.

Reply With Quote
  #4  
Old April 10th, 2007, 04:06 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,932 Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 15th Grade (Above 100000 Reputation Level)  Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1Folding Points: 391471 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 12 h 17 m 53 sec
Reputation Power: 2002
you can use arrays.
build two arrays - each will contain the fields of one of the tables,
then you can use loop.
crude sample:
VB Code:
Original - VB Code
  1. arrFields1(0) = "Table1_Field1"
  2. arrFields1(1) = "Table1_Field2"
  3. arrFields1(2) = "Table1_Field3"
  4.  
  5. arrFields2(0) = "Table2_Field1"
  6. arrFields2(1) = "Table2_Field2"
  7. arrFields2(2) = "Table2_Field3"
  8.  
  9. For x=0 To UBound(arrFields1)
  10.    Console.WriteLine("table1 field is: " & arrFields1(x) & ", table2 corresponding field is: " & arrFields2(x))
  11. Next

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Loop through fields


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT