Error 1 'KontorAdminSys.Window1.GetOfficeByName(string)' not all
Hvad gør jeg galt? :Dkode fra Window1.xaml.cs:
private Office GetOfficeByName(string s)
{
try
{
IEnumerable<Office> query = from b in _dataDc.Offices select b;
foreach (Office o in query)
{
if (o.OfficeName.Equals(s))
return o;
else
return null;
}
}
catch (Exception ex)
{
Console.Write("Error: " + ex.Message);
}
}
private void btnA1_MouseEnter(object sender, MouseEventArgs e)
{
Office o = GetOfficeByName("A1"); // temp, for testing only
btnA1.ToolTip = Convert.ToString(o.OfficeName);
}
Her er de data jeg vil hente fra db.
http://img233.imageshack.us/img233/2010/linqprobug4.jpg