我正在使用此代码在 SQL Server 中搜索数据。但结果是返回列表,我应该返回什么才能只得到一行?意味着我想使用文本块绑定来获取记录而不使用列表框模板..
public List<Customer> FindProfile(string custemail)
{
var findprofile = from r in cust.Customers where r.CustEmail == custemail select r;
return findprofile.ToList();
}
public List<Customer> GetProfileData()
{
var profiledata = from r in cust.Customers
select r;
return profiledata.Take(5).ToList();
}
public pgProfile()
{
InitializeComponent();
proxy.FindProfileCompleted += new EventHandler<FindProfileCompletedEventArgs>(proxy_FindProfileCompleted);
proxy.FindProfileAsync(custemail);
}
void proxy_FindProfileCompleted(object sender, FindProfileCompletedEventArgs e)
{
ListBox1.ItemsSource = e.Result;
}