其他语句在 foreach 循环中无法正常工作?这是我的代码。如果我的代码解释有问题会很好。
protected void getdata_Click(object sender, EventArgs e)
{
using (var db2 = new cftzClassDataContext())
{
var username = (from p in db2.cftzAccounts
where p.username.Equals(getdata2.Text)
select p);
foreach (var p in username)
{
if (getdata2.Text == p.username)
{
displayMSG.Text = "Is this correct ";
displayData.Text = p.username;
displayQuestionMark.Text = "?";
}
else
{
displayMSG.Text = "No User Found.";
}
}
}
}