SqlClient

P

Philip Carnstam

Hi,

I just started programming C++ so I trust this question is moderately dumb!
:->
In C# I could use the [] operator to access fields in the SqlDataReader
class. How do I do that in managed C++?

I tried using the Item object as well, but that did not work at all.
String* G = (String*)(*(BwData->Item("ProdId")));

Is there any similar way to access named fields in C++? I know I can
retrieve the values using get-methods, but I would rather acces them using
the [] operator.

Thanks,
Philip
 
T

Tomas Restrepo \(MVP\)

Philip,
I just started programming C++ so I trust this question is moderately dumb!
:->
In C# I could use the [] operator to access fields in the SqlDataReader
class. How do I do that in managed C++?

I tried using the Item object as well, but that did not work at all.
String* G = (String*)(*(BwData->Item("ProdId")));

Is there any similar way to access named fields in C++? I know I can
retrieve the values using get-methods, but I would rather acces them using
the [] operator.

Then use it ;)

You probably want something like (warning: unchecked)

String* G = dynamic_cast<String*>(BwData->Item[S"ProdId"]);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top