什么是ADO.NET [英] What is ADO.NET

查看:99
本文介绍了什么是ADO.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我困惑与理解ADO.NET,读了几篇文章后,我没有一个明确的概念是什么性能比较的考虑。

I puzzled with understanding ADO.NET, after reading several articles I do not have a clear idea what is perfomance consideration.

  • 什么是ADO.NET和什么有关性能比较方面的考虑?
  • 在ADO.NET可以使用SQL存储过程相关的或不同的东西?

谢谢你们!

推荐答案

想到的 Ado.net作为托管库,它提供的所有类和功能,您需要(也可能使用)来访问外部数据源。这是思考它的最简单的方法。但是,因为它不是一个单独的库(因为它包含在.NET库)人们往往混淆。我们可以说这是内部的.NET库。

Think of Ado.net as a managed library that provides all the classes and functionality you need (and may use) to access external data sources. That's the most simplest way of thinking of it. But since it's not a separate library (because it's included with the .net library) people tend to be confused. We could say it's a library inside .net.

有一个更透彻的解释可以在维基百科

A more thorough explanation can be found on Wikipedia.

存储过程是一种特殊的数据存储的一部分。 Ado.net使您能够以标准化的方式调用这些存储过程的能力。

Stored procedure is part of a particular data store. Ado.net gives you the ability to call these stored procedures in a standardized way.

从MSDN的例子

using (SqlConnection connection = new SqlConnection(connectionString))
{
    // Create the Command and Parameter objects.
    SqlCommand command = new SqlCommand(queryString, connection);
    command.Parameters.AddWithValue("@pricePoint", paramValue);

    // Open the connection in a try/catch block. 
    // Create and execute the DataReader, writing the result
    // set to the console window.
    try
    {
        connection.Open();
        SqlDataReader reader = command.ExecuteReader();
        while (reader.Read())
        {
            Console.WriteLine("\t{0}\t{1}\t{2}", reader[0], reader[1], reader[2]);
        }
        reader.Close();
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }
    Console.ReadLine();
}

您可以看到使用Ado.net类:

You can see the use of Ado.net classes:

  • 的SqlConnection
  • 的SqlCommand
  • SqlDataReader的
  • SqlConnection
  • SqlCommand and
  • SqlDataReader

所以Ado.net拥有所有这些提供给你,所以你不必每次都推倒重来,你要访问外部数据源(关系型数据库,服务等)。

So Ado.net has all these provided for you, so you don't have to reinvent the wheel every time you'd like to access external data sources (relational data bases, services etc.).

这篇关于什么是ADO.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆