简体   繁体   中英

Connecting to the database SQL Server for beginners

Just like to ask, I want to create a blog with ASP.NET as a practice to get better. I came from PHP btw.

Anyway I'm stuck because I don't know what's the way most .NET programmers use to connect to the database. I'm planning on using LINQ.

Any tutorial/books and also websites that would point me to the right dorection would really help. Thanks a lot!

The way most .NET programmers use to connect to databases is ADO.NET , included with the Microsoft .NET Framework. Here some useful code examples .

LINQ ist not designed as a replacement for ADO.NET, LINQ provides a uniform programming model for any kind of data. With it, you can query and manipulate data by using a model that is independent of data sources.

var query =
    from c in Customers
    where c.Country == "Usa"
    select c.CompanyName;

foreach (string name in query)
    Console.WriteLine(name);

.NET developers use ADO.NET to connect to relational databases. This is the low level API. Entity Framework provides an ORM on the top of ADO.NET that could map relational tables to objects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM