472,119 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

recordset VB.net

7
I have an inner join between 2 tables that have the same fields.
I need the syntax to read the values from the recordset specifying from which table to get the value.
In VB 6 it could be written for example as follows:

rs!Table.column

In VB.NET when I write

rs(“Table.column”)

It gives me the following error:

“An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in adodb.dll

Additional information: Item cannot be found in the collection corresponding to the requested name or ordinal.”
Jan 9 '07 #1
3 3091
hariharanmca
1,977 1GB
I have an inner join between 2 tables that have the same fields.
I need the syntax to read the values from the recordset specifying from which table to get the value.
In VB 6 it could be written for example as follows:

rs!Table.column

In VB.NET when I write

rs(“Table.column”)

It gives me the following error:

“An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in adodb.dll

Additional information: Item cannot be found in the collection corresponding to the requested name or ordinal.”

You cannot give like this rs(“Table.column”)

if its same name then you can give alies name for one field then use that fieldname

rs(“AliesName”)
Jan 9 '07 #2
ooshy
7
actually i have two tables:
this is the line that is giving the error im not using

Desc = rs ( "[GLOBAL].Description " ).Value
Jan 9 '07 #3
hariharanmca
1,977 1GB
actually i have two tables:
this is the line that is giving the error im not using

Desc = rs ( "[GLOBAL].Description " ).Value
Use like this
====================QRY=========================

SELECT table1.field1 as fieldof1, table2.field1 as fieldof2
FROM Table1 INNER JOIN table2 ON Table1.Field2 = table2.Field2


then you can get two different field names

then use
rst.field("fieldof1") 'for table1.field1
and
rst.field("fieldof2") 'for table2.field1
Jan 9 '07 #4

Post your reply

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

Similar topics

reply views Thread by gary artim | last post: by

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.