Hi guys.
I'm currently trying to run a LINQ query over a MS SQL database. This is what I have done.
- I can see the database, the table, and the data inside if i want to via the Server Explorer.
- I've created a new DataSet automatically from "Add new item..". I've then dragged the table from the server explorer into the designer view of the DataSet. The correct table and column headers appear. Let's call it "MyTableDataSet".
In my code, when I need to query this is what my code looks like.
MyTableDataSet data = new MyTableDataSet (); var queryResult = from c in data.MyTable select c; foreach (var date in queryResult) { // nothing! }
- Not sure why, but looking at 'queryResult' through the debugger after the query is ran I get - Empty = "Enumeration yielded no results".
Am I doing something wrong with the LINQ expression? I'm guessing that is a 'SELECT *'. The table does have data in it there's about 50 rows. Maybe I need to 'Fill' the dataset? I'm using Windows Authentication through the Server Explorer to see the data. If I can see it from there, then the code should have access as well? Not sure. :|
Thanks for any help that you guys might give in resolving this issue.