我正在尝试将存储在MS Acces数据库中的一些信息存入我的列表框。在运行以下查询时,我不会收到错误或其他内容,但它也不会显示列表框中的数据。
connection.Open();
try
{
string q = " SELECT Behandelingen.Behandeling FROM PatientBehandeling INNER JOIN Behandelingen ON PatientBehandeling.BehandelingID = Behandelingen.BehandelingID WHERE PersoonID = '" + textBoxUsername.Text + "'";
command.CommandText = q;
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
listBox1.Items.Add(reader["Behandeling"].ToString());
listBox1.Refresh();
}
}
reader.Close();
}