I will try to use a join instead.
string SQL = "select c.Versie, c.UpdateDatum, s.Softwarenaam, s.Ontwikkelaarfrom " +
"FROM Software s INNER JOIN SoftwareOpComputer c " +
"ON s.IDSoftware = c.IDSoftware " +
"WHERE c.IDComputer = '" + ZoekId + "'";
This will produce a join between Software and SotwareOpComputer. It returns all the rows from Software
and SoftwareOpComputer
tables that have a matched ID
excluding the rows that don't have a matching ID and then the WHERE condition limits the output.
Unfortunately, you use a method clDatabase.executeSelect
that doesn't seem to allow to pass a parameter to avoid the string concatenation. I suggest you to search about Parametrized query and Sql Injection to realize how this code is weak
Here some documentation on JOIN
Another aspect that I wish to improve is the loop that add the rows to the ListView
foreach (DataRow row in DT.Rows)
{
LVI = new ListViewItem();
LVI.Text = row.Field<string>("IDInstallatie"));
LVI.SubItems.Add(row.Field<string>("SoftwareNaam"));
.... etc ...
}