栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

什么是ADO.NET

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

什么是ADO.NET

可以将 Ado.net视为托管库
,它提供访问外部数据源所需(并且可能使用)的所有类和功能。这是最简单的思考方式。但是由于它不是一个单独的库(因为它包含在.net库中),人们往往会感到困惑。我们可以说这是.net内的一个库。

可以在Wikipedia上找到更详尽的解释。

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

来自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类的用法:

  • SqlConnection
  • SqlCommand
  • SqlDataReader

因此,Ado.net为您提供了所有这些功能,因此您不必每次都要访问外部数据源(关系数据库,服务等)时就重新发明轮子。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/670462.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号