Hi,
I have a DataGridView which I fill in the following way:
Function updategrid(ByVal CurrentBroker, ByVal CurrentPallet)
Dim i = 0
Dim SQLText As String
SQLText = "SELECT " & _
"invoer.idInvoer," & _
"invoer.BRKNo as Broker," & _
"invoer.Palletno as Pallet," & _
"invoer.Tabblad AS ValTabblad," & _
"Tabblad.TabbladType, " & _
"invoer.Hardwaretype as Hardwaretype," & _
"invoer.Fabrikant AS Fabrikant," & _
"invoer.Model As Model, " & _
"invoer.Serienummer, " & _
"invoer.AssetTag, " & _
"invoer.Schade, " & _
"invoer.Opmerkingen, " & _
"Tabblad.idTabblad, " & _
"invoer.details, " & _
"invoer.aantal, " & _
"invoer.RegisterDate " & _
"FROM Invoer as invoer " & _
"INNER JOIN Tabblad as Tabblad ON invoer.Tabblad = tabblad.idTabblad " & _
"WHERE invoer.BRKNo = '" & CurrentBroker & "'" & _
"AND invoer.PalletNo = " & CurrentPallet & " " & _
"ORDER BY invoer.RegisterDate DESC"
ds.Tables.Clear()
Try
Data = New DataTable
dataAdap = New MySqlDataAdapter(SQLText, dbconn)
cmdBuilder = New MySqlCommandBuilder(dataAdap)
dataAdap.Fill(ds, "Overzicht")
With DGVOverzicht
.DataSource = ds.Tables("Overzicht")
.ColumnHeadersVisible = True
.AutoGenerateColumns = True
.Visible = True
For i = 0 To .ColumnCount - 1 Step 1
Select Case .Columns(i).HeaderText
Case "ValTabblad" : .Columns(i).Visible = False
Case "details"
.Columns(i).Visible = False
Case "idTabblad" : .Columns(i).Visible = False
Case "idHWModel" : .Columns(i).Visible = False
Case "idHardware" : .Columns(i).Visible = False
Case "idInvoer" : .Columns(i).Visible = False
End Select
Next
End With
Return True
Catch ex As MySqlException
MsgBox(ex.Message)
Return False
End Try
Return 1
End Function
This works like a charm, but I need to add a column next to the column which I hide: Details.
The Column Details holds the ID's of all details selected in the record (e.g. 1;5;2;19;20;100)
I want to give the user a bit more information about the actual selected details, e.g. by do a lookup in MySQL to see what details those ID's actually are..
However, I was told not to do a inner join on a comma separated list in MySQL due to the fact that it would be 'slow as frozen snail'..
So the next thing I can think of is filling the DGV with all the information from the Database, hide the ID column and 'find and replace' the values in another cell, and thus looking it up in MySQL..
If anyone could point me into some kind of direction in this, I'd be very grateful.. since I'm staring at the code for over a few hours now, and not a single lightbulbs seems to pop up :)
Thank in advance!