SqlClient

  • Thread starter Thread starter Philip Carnstam
  • Start date Start date
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
 
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"]);
 
Back
Top