a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Field Name Detection

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Field Name Detection
Page: [1]
 
accessman

 

Posts: 74
Joined: 9/13/2005
Status: offline

 
Field Name Detection - 10/4/2005 1:18:44   
Hi, I have a problem.

Suppose I have one Excel file to import in the MS Access, and I will copy the content to another table.

eg. File 1:
Unit FileNum Code
a____b______c
File 2:
Unit FileNum Code

rs .....("File 2")
rstemp.....("File 1")

In VB, I will write like this:
rs.Fields("Unit") = rstemp.Fields("Unit").value
rs.Fields("FileNum") = rstemp.Fields("FileNum").value
rs.Fields("Code") = rstemp.Fields("Code").value

After that,
File 2:
Unit FileNum Code
a____b______c

But, if the File 1:
Unit2 Num Code
a_____b______c

the Field Name is different on next time, then it doesn't work, but the content is same.
How can I copy the data to File 2 even though the field name is not same,
of course, we can set
rs.Fields("Unit") = rstemp.Fields("Unit2").value
rs.Fields("FileNum") = rstemp.Fields("Num").value
rs.Fields("Code") = rstemp.Fields("Code").value

But, can the program detect the column 1, column 2, column3, like that, don't need to use field name, it still can be copied to.
Like that:
rs.Fields("Unit") = column1.value
rs.Fields("FileNum") = column2.value
rs.Fields("Code") = column2.value
Does anybody know how to do? Thanks a lot. Thanks.

rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Field Name Detection - 10/4/2005 8:15:51   
IIRC the column ordinal syntax is:

RS.Fields(x)

So the first column is RS.Fields(0) as the fieldnames array is 0 based. So if all the fields are in a 1-to-1 matchup for where values should go, you could do something like:

For fnum = 0 To RS.Fields.Count-1
rs.Fields(fnum) = rstemp.Fields(fnum).value
Next

That help any.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to accessman)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> Field Name Detection
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts