How can I do a C # query in a SQL Server database [closed]

-3

I have a project under development on this internship and so I am working on new things. I would like to know how I can do in C # a data query present in SQL Server tables. Sorry if you're being too lazy.

    
asked by anonymous 23.01.2017 / 15:34

2 answers

1

Boy, several paths lead to Rome ...

You can use ADO.NET, Dapper, or some more complex ORM. Type Nhibernate and Entity framework ...

It seems that your knowledge is very basic ... You have a big way ahead of you ... Want a tip? I would not do it for ADO.NET ... I would start with Dapper and then migrate to NH or EF.

I do not know anyone who uses ADO.NET professionally hj in day ....

Well the page to start understanding Dapper.net is this. link

But if you get lost, you better start from scratch .... link

    
23.01.2017 / 15:58
1

There are several ways to do this as you did not specify which development would be Web or Desktop, in case if it is a Web app could do so using the EntityFramework in its context do so:

   public List<GetPersonResult> GetPeople()
 {
       return (from p in dbContext.People
              select new GetPersonResult
              {
                   UserName = p.Username,
                   EmailAddress = p.Email
              }).ToList();
 }

 public class GetPersonResult
 {
       public string UserName{get;set;}
       public string EmailAddress{get;set;}
 }

Specify better which Web or Desktop environment. blz

    
23.01.2017 / 15:55