Click here to Skip to main content
15,881,757 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Richard MacCutchan26-Nov-14 2:46
mveRichard MacCutchan26-Nov-14 2:46 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Member 1123037226-Nov-14 3:17
Member 1123037226-Nov-14 3:17 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Richard MacCutchan26-Nov-14 3:20
mveRichard MacCutchan26-Nov-14 3:20 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Member 1123037226-Nov-14 3:44
Member 1123037226-Nov-14 3:44 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Richard MacCutchan26-Nov-14 4:11
mveRichard MacCutchan26-Nov-14 4:11 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Member 1123037226-Nov-14 9:06
Member 1123037226-Nov-14 9:06 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Richard MacCutchan26-Nov-14 9:50
mveRichard MacCutchan26-Nov-14 9:50 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Member 1123037226-Nov-14 23:23
Member 1123037226-Nov-14 23:23 
Hi Richard

Thanks. I've made a simple console app and can confirm that the String class does work and you could create string variables such as string codeproject without problem. However,based on facts it looks like a different story when dealing with c++/cli.

Back to the main standard deviation calculation, i think it could not work as a columns can't directly be assigned to a type and treated like a variable (see below). it could have worked in vba by selecting the column range and perform the built-in functions: c++ sqrt() or math::sqrt().

Hence the solution of last resort: iterate through each row and perform the calculation in several steps (get the mean from "DataRet" column first, then carry out ... ) unless a you have a better idea. Cheers

Error C2440: 'initializing' : cannot convert from 'System::Data::DataColumn ^' to 'double'



C#
DataTable^dbdataset=gcnew DataTable();
                     DataColumn^rt_col=gcnew DataColumn();
                     rt_col->ColumnName = "DataRet";
                     rt_col->DataType=System::Type::GetType("System.Double");
                     dbdataset->Columns->Add(rt_col);

                     sda->Fill(dbdataset);

                     double varet = dbdataset->Columns["DataRet"]; //already double type, no need System::Convert::ToDouble
                     double vola = sqrt(varet);
                     lblvol->Text = Convert::ToString(vola);

GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Richard MacCutchan27-Nov-14 0:02
mveRichard MacCutchan27-Nov-14 0:02 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Member 1123037227-Nov-14 1:19
Member 1123037227-Nov-14 1:19 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Richard MacCutchan27-Nov-14 1:33
mveRichard MacCutchan27-Nov-14 1:33 
GeneralRe: c++ Windows Form app: How to grant public access to DataTable object? Pin
Member 1123037227-Nov-14 2:12
Member 1123037227-Nov-14 2:12 
QuestionFormat int in C Pin
Member 1056002225-Nov-14 4:47
Member 1056002225-Nov-14 4:47 
AnswerRe: Format int in C Pin
Albert Holguin25-Nov-14 5:01
professionalAlbert Holguin25-Nov-14 5:01 
QuestionRe: Format int in C Pin
David Crow25-Nov-14 16:34
David Crow25-Nov-14 16:34 
AnswerRe: Format int in C Pin
Kornfeld Eliyahu Peter25-Nov-14 22:49
professionalKornfeld Eliyahu Peter25-Nov-14 22:49 
GeneralPerform operations on c++ DataTable Pin
Member 1123037223-Nov-14 12:27
Member 1123037223-Nov-14 12:27 
GeneralRe: Perform operations on c++ DataTable Pin
PIEBALDconsult23-Nov-14 12:36
mvePIEBALDconsult23-Nov-14 12:36 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037223-Nov-14 12:54
Member 1123037223-Nov-14 12:54 
GeneralRe: Perform operations on c++ DataTable Pin
bryce23-Nov-14 12:40
bryce23-Nov-14 12:40 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037223-Nov-14 12:56
Member 1123037223-Nov-14 12:56 
GeneralRe: Perform operations on c++ DataTable Pin
Nelek23-Nov-14 13:20
protectorNelek23-Nov-14 13:20 
GeneralRe: Perform operations on c++ DataTable Pin
bryce23-Nov-14 13:41
bryce23-Nov-14 13:41 
GeneralRe: Perform operations on c++ DataTable Pin
Nelek23-Nov-14 22:52
protectorNelek23-Nov-14 22:52 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 0:02
Member 1123037224-Nov-14 0:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.