In the Models folder under the application, add----new Item---"ADO." NET Entity Data Model--and then select the model content--After the next "Select your database Connection". The database I chose here is sales. Then next, "Select Database Object" You can select the table you want, or view, in front of the table or view you want to tick on it, here I choose the T_userinfo table. I found salesmodel.edmx after the new building.
After clicking on the small triangular symbol in front of SALESMODEL.EDMX, the SalesModel.edmx.Designer.cs file will be displayed under SALESMODEL.EDMX. Open the file and you'll see
One way: public partial class Salesentities:objectcontext
One of the salesentities is the ADO model entity class we created. (Note: I chose the sales database here.) So the name of my entity model class is salesentities. The different database entity model class names you choose are not the same. But it all ends in *****entities.)
Less nonsense.
using (var datas = new SalesEntities ()) { var query = from UserInfo in datas. T_userinfo where UserInfo. Name==username Select New {userinfo. Name}; The Any () method is: Determines whether the sequence contains any elements if (query = = NULL | |!query. Any ()) { //query = = NULL | |!query. Any () means if the data is not queried. Or how to handle a query that does not contain any elements inside the object } }
Linq access to databases