Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

C++ VS 6.0 ADO Access fields by number.

Posted on 2004-03-29
3
Medium Priority
?
299 Views
Last Modified: 2010-04-01
I figured out how to access columns in a row by using "_bstr_t xBar2 = (_bstr_t) m_Recordset->Fields->GetItem("xbar_2")->Value;".

Can someone please tell me how to access the columns by using a column# instead of name?
0
Comment
Question by:mmouer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
shalmak earned 1500 total points
ID: 10707240
I believe its simply:

_bstr_t xBar2 = (_bstr_t) m_Recordset->Fields->GetItem(1)->Value;

that is, provide a number instead of a string to GetItem.

Quoting from the msdn:

In Visual C++, the GetItem(index) method returns a member of the collection. Index is a Variant, the value of which is either a numerical index of the member in the collection, or a string containing the name of the member.

hope this helps
Shalmak
0
 
LVL 15

Expert Comment

by:lakshman_ce
ID: 10707261
GetItem(colIndex) should work right?

Plz refer to code at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdprotypexvc.asp

-Lakshman
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question