Click here to Skip to main content
15,563,228 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Perform operations on c++ DataTable Pin
bryce23-Nov-14 14:41
bryce23-Nov-14 14:41 
GeneralRe: Perform operations on c++ DataTable Pin
Nelek23-Nov-14 23:52
protectorNelek23-Nov-14 23:52 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 1:02
Member 1123037224-Nov-14 1:02 
GeneralRe: Perform operations on c++ DataTable Pin
Nelek24-Nov-14 1:52
protectorNelek24-Nov-14 1:52 
GeneralRe: Perform operations on c++ DataTable Pin
Nareesh123-Nov-14 14:33
Nareesh123-Nov-14 14:33 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037223-Nov-14 23:29
Member 1123037223-Nov-14 23:29 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan23-Nov-14 23:24
mveRichard MacCutchan23-Nov-14 23:24 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 0:52
Member 1123037224-Nov-14 0: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 1:11
mveRichard MacCutchan24-Nov-14 1:11 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 1:27
Member 1123037224-Nov-14 1:27 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan24-Nov-14 1:31
mveRichard MacCutchan24-Nov-14 1:31 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 1:38
Member 1123037224-Nov-14 1:38 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan24-Nov-14 1:52
mveRichard MacCutchan24-Nov-14 1:52 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 2:00
Member 1123037224-Nov-14 2:00 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan24-Nov-14 2:22
mveRichard MacCutchan24-Nov-14 2:22 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 2:39
Member 1123037224-Nov-14 2:39 
GeneralRe: Perform operations on c++ DataTable Pin
Richard MacCutchan24-Nov-14 2:56
mveRichard MacCutchan24-Nov-14 2:56 
GeneralRe: Perform operations on c++ DataTable Pin
Member 1123037224-Nov-14 8:54
Member 1123037224-Nov-14 8:54 
QuestionClasses and List of classes Pin
mrkeivan21-Nov-14 20:58
mrkeivan21-Nov-14 20:58 
AnswerRe: Classes and List of classes Pin
Richard MacCutchan21-Nov-14 22:31
mveRichard MacCutchan21-Nov-14 22:31 
QuestionDynamically re sizable dialog Pin
techkrish21-Nov-14 1:06
techkrish21-Nov-14 1:06 
AnswerRe: Dynamically re sizable dialog Pin
Richard MacCutchan21-Nov-14 22:26
mveRichard MacCutchan21-Nov-14 22:26 
SuggestionRe: Dynamically re sizable dialog Pin
David Crow22-Nov-14 5:42
David Crow22-Nov-14 5:42 
AnswerRe: Dynamically re sizable dialog Pin
«_Superman_»25-Nov-14 19:56
professional«_Superman_»25-Nov-14 19:56 
Questionstock market code please Pin
Eslam Said Khashb20-Nov-14 12:04
Eslam Said Khashb20-Nov-14 12: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.