I can successfully connect to the database using my datacontext object. I can successfully read and write to the database, however I cannot use the same syntax that others use.
For example, when I need data from a table, I should do something like this:
db = new UserDataDataContext(WebConfigurationManager.ConnectionStrings["UserData"].ConnectionString);
IQueryable Users = db.GetTable<User>();
I would like to write linq queries, for example, as I see how others do this:
db = new UserDataDataContext(WebConfigurationManager.ConnectionStrings["UserData"].ConnectionString);
var query = from u in db.User
where u.UserName == "Test"
select u;
But intellisense will not recognize the user as a db property and therefore will not compile. Intellisense does not show any properties that appear related to tables or objects in my database.
Here is the error message I get:
'System.Data.Linq.DataContext' does not contain a definition for 'User' and no extension method 'User' accepting a first argument of type 'System.Data.Linq.DataContext' could be found (are you missing a using directive or an assembly reference?)
Here is a summary of what I'm doing:
I used the database constructor, dragged the tables that I wanted.
dbml.
, dataContext, UserDataDataContext. UserDataDataContext db, Web.config.
linq, , db, .
, , , . ?