Doug Murray
October 13th, 2002, 06:49 PM
SqlDataReader : I need to assign retrieved value to C++ variable
ADO.NET in C++
SqlDataReader
I can get the following to work, the result displaying on the screen:
Console::WriteLine(myReader->GetSqlValue(3));
What I really need to do is to assign the item retrieved to a C++ variable eg.
int halfhrSQL = myReader->GetSqlValue(3);
This gives the C2440 compile error: cannot convert from 'System::Object __gc *' to 'int'.
No matter what cast I use, I cannot get around the error.
Please help if you can.
Thanks, Doug (New Zealand)
ADO.NET in C++
SqlDataReader
I can get the following to work, the result displaying on the screen:
Console::WriteLine(myReader->GetSqlValue(3));
What I really need to do is to assign the item retrieved to a C++ variable eg.
int halfhrSQL = myReader->GetSqlValue(3);
This gives the C2440 compile error: cannot convert from 'System::Object __gc *' to 'int'.
No matter what cast I use, I cannot get around the error.
Please help if you can.
Thanks, Doug (New Zealand)