private SqlTableColumn[] GetSqlTable(SqlCommand command) { var reader = command.ExecuteReader(); var fieldCount = reader.FieldCount; reader.Close(); SqlTableColumn[] sqlTable = new SqlTableColumn[fieldCount]; for (int i = 0; i < fieldCount; i++) { reader = command.ExecuteReader(); sqlTable[i] = new SqlTableColumn(reader.GetName(i)); while (reader.Read()) { sqlTable[i].values.Add(reader.GetValue(i)); } reader.Close(); } return(sqlTable); }
private async Task <SqlTableColumn[]> GetSqlTableAsync(SqlCommand command) { var reader = await command.ExecuteReaderAsync(); var fieldCount = reader.FieldCount; reader.Close(); SqlTableColumn[] sqlTable = new SqlTableColumn[fieldCount]; for (int i = 0; i < fieldCount; i++) { reader = await command.ExecuteReaderAsync(); sqlTable[i] = new SqlTableColumn(reader.GetName(i)); while (await reader.ReadAsync()) { sqlTable[i].values.Add(reader.GetValue(i)); } reader.Close(); } return(sqlTable); }