i have one stupid problem and I’m not sure how to fix it.
I work with Silverlight and Visual Studio 2010. To connect to a database i used
LINQ to SQL. So far so good. Everything works fine, but at the end the result i get is
a query string and no value.
My code in the WCF Service file:
public string get_info()
{
LinqMapInfoDataContext context = new LinqMapInfoDataContext();
var result = from x in context.mytabel
where (x.map_x == 4) && (x.map_y == 7)
select x.id;
string returnValue = result.ToString();
return returnValue;
}
and my code in mainpage.xaml.cs
private void ser_client_get_infoCompleted(object sender, ServiceRefMapInfo.get_infoCompletedEventArgs e)
{
lbl_key.Content = e.Result.ToString();
}
Well, i really thought i would get “id” (a concrete string value) shown in my browser after compiling my project, but no. lbl_key.Content shows:
SELECT [t0].[id] FROM [dbo].[mytable] AS [t0]
Your code should be: