lundi 1 février 2016

Dataset not getting the data from child table

I am using a dataset to create a combined table and display it in a datagridview. So far I get the columns but no data under those columns. The database is a SQLite and using two tables to get the needed data. Table 1 contains a sample_id field with other data and Table 2 contains a sample_id field too and two other fields, one is size (1-100) and particle_data. So it looks like this (sample_id, size, data => 12 1 10 | 12 2 11 | 12 3 8 | 12 4 9 etc.)

This is the dataset creation:

Dim dataCombined As DataSet = New DataSet
    dataCombined.Tables.Add(queryResult)
    dataCombined.Tables.Add(particleQuery)
    dataCombined.Relations.Add("combinedSource", queryResult.Columns("sample_id"), particleQuery.Columns("sample_id"))
    For i As Integer = 1 To 100
        queryResult.Columns.Add(i.ToString(), GetType(Integer))
     Next i
SearchResults.DataSource = dataCombined.Tables(0)

The display:

For item As Integer = 1 To 100
    SearchResults.Columns(item.ToString()).HeaderText = item.ToString()
Next item

So the problem is column headers displayed, but no data under them. My guess is I need to provide somehow the data to display, but no idea how can I achieve it.

Aucun commentaire:

Enregistrer un commentaire