简体   繁体   English

为初学者连接到数据库SQL Server

[英]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. 就像我要问的那样,我想创建一个使用ASP.NET的博客来做一个更好的实践。 I came from PHP btw. 我来自PHP btw。

Anyway I'm stuck because I don't know what's the way most .NET programmers use to connect to the database. 无论如何,我都被卡住了,因为我不知道大多数.NET程序员用来连接数据库的方式是什么。 I'm planning on using LINQ. 我正在计划使用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. 大多数.NET程序员用来连接数据库的方式是Microsoft .NET Framework附带的ADO.NET 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. LINQ并非旨在替代ADO.NET,而是为任何类型的数据提供统一的编程模型。 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. .NET开发人员使用ADO.NET连接到关系数据库。 This is the low level API. 这是底层API。 Entity Framework provides an ORM on the top of ADO.NET that could map relational tables to objects. 实体框架在ADO.NET的顶部提供了一个ORM,它可以将关系表映射到对象。

If you are new i will advise you to start with linq, but before that you should learn a little bit about ADO.Net, and whats better then msdn tutorials: 如果您是新手,我建议您从linq开始,但是在此之前,您应该学习一些有关ADO.Net的知识,然后再进一步了解msdn教程:

ADO.Net: http://msdn.microsoft.com/en-us/library/h43ks021%28v=vs.71%29.aspx ADO.Net: http://msdn.microsoft.com/en-us/library/h43ks021%28v=vs.71%29.aspx

http://msdn.microsoft.com/en-us/library/cc161165.aspx http://msdn.microsoft.com/en-us/library/cc161165.aspx

Linq: http://msdn.microsoft.com/en-us/library/bb386964.aspx Linq: http : //msdn.microsoft.com/en-us/library/bb386964.aspx

http://www.codeproject.com/Articles/246861/LINQ-to-Entities-Basic-Concepts-and-Features http://www.codeproject.com/Articles/246861/LINQ-to-Entities-Basic-Concepts-and-Features

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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