2012-01-26 67 views
0

我是Visual Studio 2010的新手,在MSDN上看到很少的C++示例,所以希望得到一些幫助。在Visual Studio 2010中將行寫入數據集的問題C++

我已經使用的數據集函數從工具箱窗口中創建一個表有三列(爲簡便起見我在下面的例子中留下了他們兩個

我收到以下錯誤:

錯誤C3293:「項目」:使用「默認」爲類訪問默認屬性(索引)「系統::數據::的DataRow」

這裏是由VS2010實例化表生成的代碼:

this->GraphInput->DataSetName = L"GraphDataIn"; 
this->GraphInput->Tables->AddRange(gcnew cli::array<System::Data::DataTable^>(1) {this->RefElectInput}); 

//RefElectInput 
this->RefElectInput->Columns->AddRange(gcnew cli::array<System::Data::DataColumn^>(3) {this->RefElect0Av, this->RefElect0Max, this->RefElect0Min}); 
this->RefElectInput->MinimumCapacity = 7; 
this->RefElectInput->TableName = L"RefElecInput"; 
// 
// RefElect0Av 
// 
this->RefElect0Av->ColumnName = L"RefElect0Av"; 
this->RefElect0Av->DataType = System::Double::typeid; 

這裏就是我試圖towrite到行(我只出一列)代碼:

DataRow^ myRow; 
myRow = RefElectInput->NewRow(); 
myRow->Item[L"RefElect0Av"] = peUnPackDataRec->saeRefElec0.adfRefElecAv[i]; 
//the error data is of type doubleoccurs here. 

//other column's removed. 

RefElectInput->Rows->Add(myRow); 

我將是你的援助表示感謝。

謝謝西蒙

回答

0

你試過:

DataRow^ myRow; 
myRow = RefElectInput->NewRow(); 
myRow->default[L"RefElect0Av"] = peUnPackDataRec->saeRefElec0.adfRefElecAv[i];