Beispiel #1
0
		private string[] GetColumnNames(runrepResultsPortfolioStruct selectReturn)
        {
            runrepResultsRecordStruct record0 = (runrepResultsRecordStruct)selectReturn.results[0].record[0];

            int columnCount = record0.field.Length;
            string[] columns = new string[columnCount];

            for (int i = 0; i < columnCount; i++)
                columns[i] = record0.field[i].name;

            return columns;

        }
Beispiel #2
0
	    private DataTable ConvertToDataTable(runrepResultsPortfolioStruct selectReturn)
        {
            DataTable dt = new DataTable(selectReturn.results[0].portfolioName);

            string[] columns = GetColumnNames(selectReturn);
            foreach (string s in columns)
            {
                DataColumn dc = new DataColumn(s);
                dt.Columns.Add(dc);
            }

            int rowCount = selectReturn.results[0].record.Length;
            for (int i = 0; i < rowCount; i++)
            {
                runrepResultsRecordStruct row = selectReturn.results[0].record[i];

                DataRow dr = dt.NewRow();
                for (int j = 0; j < columns.Length; j++)
                {
                    dr[j] = row.field[j].value;
                }
                dt.Rows.Add(dr);
            }

            return dt;
        }