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

C / C++ / MFC

 
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 
GeneralRe: Perform operations on c++ DataTable Pin
Nelek24-Nov-14 0:52
protectorNelek24-Nov-14 0:52 
GeneralRe: Perform operations on c++ DataTable Pin
Nareesh123-Nov-14 13:33
Nareesh123-Nov-14 13:33 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037223-Nov-14 22:29
Member 1123037223-Nov-14 22:29 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan23-Nov-14 22:24
mveRichard MacCutchan23-Nov-14 22:24 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037223-Nov-14 23:52
Member 1123037223-Nov-14 23:52 
Hi Richard
First of all thanks for the assistance.
Basically what I am trying to achieve can be described as follows:

1-creating a database connexion, run a query and store the result in my Datatable's object dbdataset(see code below). city table has 5 columns
2-adding an extra column "ret" to dbdataset

C#
MySqlCommand^CmdDataBase = gcnew MySqlCommand("select * from world.city",conDataBase);
                try{
                    conDataBase->Open();
                    MySqlDataAdapter^sda= gcnew MySqlDataAdapter();
                    sda->SelectCommand=CmdDataBase;
                    DataTable^dbdataset=gcnew DataTable();
                    DataColumn^rt_col=gcnew DataColumn();
                    rt_col->ColumnName = "Ret";
                    rt_col->DataType=System::Type::GetType("System.Double");
                    dbdataset->Columns->Add(rt_col);


3-fill "ret" rows based on values from column "Population"
C#
DataRow^rt_row;


                     for (int row=0;row<dbdataset->Rows->Count;row++)
                     {
                         rt_row=dbdataset->NewRow();
                         rt_row["Ret"]=log(System::Convert::ToDouble(rt_row["Population"][row])/System::Convert::ToDouble(rt_row["Population"][row-1]));
                         //rt_row["DataReturn"]=System::Convert::ToDouble(dbdataset->Rows[row]["Population"])/System::Convert::ToDouble(dbdataset->Rows[row-1]["Population"]);
                         dbdataset->Rows->Add(rt_row);


1- and 2- are fine but I am completely stuck on 3. Hope you understand better my goal through this explanation. cheers

member 11230372
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan24-Nov-14 0:11
mveRichard MacCutchan24-Nov-14 0:11 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 0:27
Member 1123037224-Nov-14 0:27 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan24-Nov-14 0:31
mveRichard MacCutchan24-Nov-14 0:31 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 0:38
Member 1123037224-Nov-14 0:38 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan24-Nov-14 0:52
mveRichard MacCutchan24-Nov-14 0:52 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 1:00
Member 1123037224-Nov-14 1:00 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan24-Nov-14 1:22
mveRichard MacCutchan24-Nov-14 1:22 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 1:39
Member 1123037224-Nov-14 1:39 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan24-Nov-14 1:56
mveRichard MacCutchan24-Nov-14 1:56 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 7:54
Member 1123037224-Nov-14 7:54 
QuestionClasses and List of classes Pin
mrkeivan21-Nov-14 19:58
mrkeivan21-Nov-14 19:58 
AnswerRe: Classes and List of classes Pin
Richard MacCutchan21-Nov-14 21:31
mveRichard MacCutchan21-Nov-14 21:31 
QuestionDynamically re sizable dialog Pin
techkrish21-Nov-14 0:06
techkrish21-Nov-14 0:06 
AnswerRe: Dynamically re sizable dialog Pin
Richard MacCutchan21-Nov-14 21:26
mveRichard MacCutchan21-Nov-14 21:26 
SuggestionRe: Dynamically re sizable dialog Pin
David Crow22-Nov-14 4:42
David Crow22-Nov-14 4:42 
AnswerRe: Dynamically re sizable dialog Pin
«_Superman_»25-Nov-14 18:56
professional«_Superman_»25-Nov-14 18:56 
Questionstock market code please Pin
Eslam Said Khashb20-Nov-14 11:04
Eslam Said Khashb20-Nov-14 11:04 

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.