Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Teradata Field names and DAO/ADO/OLEDB access problem

Status
Not open for further replies.

larry609

IS-IT--Management
Oct 11, 2010
3
US
Here's the issue:
When accessing Teradata from MS Access 2007/XP/32bit, let's say I have a table called WELL. In that table, the first (and key) field is Well_Id.

Using DAO, I can say, rs!Well_ID or rs.Fields("Well_Id") and return the well id.
Using ADO, if there's no CAPTION, I can do the same. HOWEVER, if there *IS* a caption, I MUST use that caption.
So, let's say the caption is "Well Identifier"). Now, if I use rs!Well_Id, the statement fails. If I use rs.fields("Well_Id") the statement fails.
Only if I use rs.Fields("Well Identifier") does the statement succeed.
So - the answer is to remove all captions. Ok, fair enough, but not possible on tables that I'm linking to where other programs depend on the caption.
So, where there is a caption, I use that; where there isn't a caption, I use the field ID.

Using TDOLEDB, the problem is worse.
I can no longer say rs!Well_Id nor rs.fields("Well_Id"), I must say rs.fields("Well Id") as Teradata removes the underscores.
I have not tried tables with captions as the field ID problem, alone. presents a severe problem.

My only solution thus far is to write a program that creates CONST variables of the BYTE type that resolve to the absolute field position. And because Well_Id is used in several related tables, I must include the Table name.

ie.
Const tWellfWell_Id as Integer = 0

Then, I can use rs.fields(tWellfWell_Id) to return a value. Obviously, if a table is reorganized, I'd need to create a new constants list - no big deal. And since I'm using the table name and field name, the code is still readable. (using the actual number, like rs.fields(0) is NOT reasonable as mistakes WILL be made)

Has anyone found a way around this problem, such as a connection parameter, that I haven't found?

Any other suggestions?

Thanks,
Larry Wilson
ConocoPhillips, Houston
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top