我试过这段代码:
SqlCommand selectcurrentuserid = new SqlCommand("select ID_UTENTI from UTENTI where USERNAME_UTENTI='" + Login.currentUser + "'", conn);
currentuserid = (int)selectcurrentuserid.ExecuteScalar();
SqlCommand selectarea = new SqlCommand("select ID_AREA from VISUALIZZAZIONE_UTENTI where ID_UTENTE='" + currentuserid + "'", conn);
msa = new SqlDataAdapter("select * from AREAGEOMETRY1 where AREAGEOMETRY_PROTEZIONE='false' or AREAGEOMETRY_WINAAREA_ID='" + (int)selectarea.ExecuteScalar() + "'", conn);
msa.Fill(data);
但是这样命令selectarea只选择第一个ID_AREA而不是所有具有相同值的ID_ARA。