mardi 18 août 2015

Maping O2GAccountsTable to DataGridView error !

I am new in C#developer. I try to get information from O2GAccountsTable and show in DataGridView but i get the error when binding .
This is my Code :

1) DataTable accountTable = new DataTable(); // Creat new DataTable;
2) O2GAccountsTable accTb = Accountfxcm.AccountInfo(); // This funtion get the O2GAccountsTable affter login success;
3) Creat the column for accountTable
for (int k = 0; k < accTb.Columns.Count; k++)
{
O2GTableColumn column = accTb.Columns[k];
accountTable.Columns.Add(column.ID,column.ColumnType.GetType() );

}
4) Add info to accountTable
accountTable.Rows.Add(accTb.getRow(0).AccountID.ToString(),accTb.getRow(0).AccountName.ToString(),.....more arg);
5) Binding to DataGridView;
try
{
dataGridViewAcc.DataSource = accountTable;// Error happen from here ;
}
catch (Exception ex)
{
throw ex;
}
The error happen when binding dataGridViewAcc.DataSource = accountTable with the first columns AccountID (type string).
Error message is :
The following exception occure in DataGridView . System.ArgumentException : The value '938326' is not a valid value for the enum 'O2GTableColumnType' at... See more at the attach file.

Value 938326 is AccountID type string but i do not know how to fix.

I am using VS2013 and Debug platform x64.

Give me an advise to fix this problem, please !
รูป
 


Aucun commentaire:

Enregistrer un commentaire