|
 |
activex_data_objects thread: passing fieldname like a variable
Message #1 by "Petur Kirke" <peturkirke@h...> on Wed, 15 Aug 2001 17:47:17
|
|
I have 2 tables. One of the fields in Table1 contains some
of the field names in table2.
I need to loop through table1. While i do the loop, I need to find
the value in the referenced column in table2.
Normally when i refer to a recordset, i do it something like this:
rs("fieldname")
but now i need/want to do something like this:
rs(rs("fieldname"))
I cant get this to work. Does someone know how I can do this ?
Is it impossible to use variables in this recordset syntax ?
Message #2 by "Wally Burfine" <oopconsultant@h...> on Thu, 16 Aug 2001 04:04:59 +0000
|
|
You might do a response.write before referencing the 2nd rs:
Response.Write rs1("fieldname") & "<br>" & vbcrlf
Response.Write rs2(rs1("fieldname") & "<br>" & vbcrlf
>From: "Petur Kirke" <peturkirke@h...>
>Reply-To: "ActiveX_Data_Objects" <activex_data_objects@p...>
>To: "ActiveX_Data_Objects" <activex_data_objects@p...>
>Subject: [activex_data_objects] passing fieldname like a variable
>Date: Wed, 15 Aug 2001 17:47:17
>
>I have 2 tables. One of the fields in Table1 contains some
>of the field names in table2.
>I need to loop through table1. While i do the loop, I need to find
>the value in the referenced column in table2.
>
>Normally when i refer to a recordset, i do it something like this:
>
>rs("fieldname")
>
>but now i need/want to do something like this:
>
>rs(rs("fieldname"))
>
>I cant get this to work. Does someone know how I can do this ?
>Is it impossible to use variables in this recordset syntax ?
>
Message #3 by "Bambang Lai" <bambanglai@y...> on Sat, 18 Aug 2001 01:29:57
|
|
how bout storing the result of first recordset to temp variable, then
assign that variable for the second rs set.
ex:
dim temp1, temp2
temp1 = rs("fieldnameT1")
.....
.....
temp 2 = rs(chr(34) & temp & chr(34))
where chr(34) represent quotation in ASCII table.
BB.
Message #4 by Thomas Bellavia <TBellavia@V...> on Tue, 28 Aug 2001 09:51:52 -0400
|
|
Use SQL statements to generate custom recordsets containing only the data
you need...
-----Original Message-----
From: Petur Kirke [mailto:peturkirke@h...]
Sent: Wednesday, August 15, 2001 1:47 PM
To: ActiveX_Data_Objects
Subject: [activex_data_objects] passing fieldname like a variable
I have 2 tables. One of the fields in Table1 contains some
of the field names in table2.
I need to loop through table1. While i do the loop, I need to find
the value in the referenced column in table2.
Normally when i refer to a recordset, i do it something like this:
rs("fieldname")
but now i need/want to do something like this:
rs(rs("fieldname"))
I cant get this to work. Does someone know how I can do this ?
Is it impossible to use variables in this recordset syntax ?
|
|
 |