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); DataRow^rt_row; for (int row=0;dbdataset->Rows->Count;row++) { rt_row=dbdataset->NewRow(); rt_row["Ret"]=System::Convert::ToDouble(rt_row["Population"])/System::Convert::ToDouble(rt_row["Population"]); //rt_row["DataReturn"]=System::Convert::ToDouble(dbdataset->Rows[row]["Population"])/System::Convert::ToDouble(dbdataset->Rows[row-1]["Population"]); dbdataset->Rows->Add(rt_row); } sda->Fill(dbdataset); BindingSource^bSource=gcnew BindingSource(); bSource->DataSource=dbdataset; dtGrid->DataSource=bSource; } catch(Exception^ex) { MessageBox::Show(ex->Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)