我应该在哪里使用模式连接和断开连接? [英] Where Should I Use Mode Connected And Disconnected?

查看:89
本文介绍了我应该在哪里使用模式连接和断开连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建c#app

i对于模式连接有什么不同

和断开连接以及我应该在哪里使用它们?

解决方案

这是不可能的废话。让我们来看看。您的标签是ASP.NET和C#,即服务器端技术。现在,您已从服务器断开连接。你有访问ASP.NET的权限吗?当然不是。而不是问关于差异的完全无效的问题,最好花一些时间来学习Web做什么,至少一些基础知识。



-SA


参考 - ADO。 NET体系结构 [ ^ ]

Quote:

选择DataReader或DataSet



当您决定应用程序是否应使用 DataReader 时(请参阅使用DataReader(ADO.NET)检索数据 [ ^ ])或 DataSet (参见 DataSet,DataTabl es和DataViews(ADO.NET) [ ^ ]),请考虑应用程序所需的功能类型。使用 DataSet 执行以下操作:

  • 在应用程序中本地缓存数据,以便您可以对其进行操作。如果您只需要读取查询结果, DataReader 是更好的选择。
  • 层之间或XML Web服务之间的远程数据。
  • 动态交互数据,例如绑定到Windows窗体控件或组合和关联来自多个源的数据。
  • 对数据执行大量处理,无需打开数据源连接,从而释放连接其他客户使用。


如果您不需要 DataSet 提供的功能,您可以通过使用提高应用程序的性能 DataReader 以只读,只读方式返回数据。虽然 DataAdapter 使用 DataReader 来填充 DataSet 的内容(参见 DataAdapter (ADO.NET)中填充数据集 [ ^ ]),使用 DataReader ,您可以提高性能,因为您将节省 DataSet 将占用的内存,并避免创建和填充 DataSet <的内容所需的处理/ b>

i'm trying to create c# app
i was wondring what's the different between mode connected
and disconnected and where should i use everyone of them??

解决方案

This is the impossible nonsense. Let's see. Your tags are "ASP.NET" and "C#", that is, server-side technology. Now, you are disconnected from the server. Do you have any access to ASP.NET? Of course not. Instead of asking totally invalid questions about "difference", better spend some time in learning what Web does, at least some basics.

—SA


Refer - ADO.NET Architecture[^]

Quote:

Choosing a DataReader or a DataSet

When you decide whether your application should use a DataReader (see Retrieving Data Using a DataReader (ADO.NET)[^]) or a DataSet (see DataSets, DataTables, and DataViews (ADO.NET)[^]), consider the type of functionality that your application requires. Use a DataSet to do the following:

  • Cache data locally in your application so that you can manipulate it. If you only need to read the results of a query, the DataReader is the better choice.
  • Remote data between tiers or from an XML Web service.
  • Interact with data dynamically such as binding to a Windows Forms control or combining and relating data from multiple sources.
  • Perform extensive processing on data without requiring an open connection to the data source, which frees the connection to be used by other clients.

If you do not require the functionality provided by the DataSet, you can improve the performance of your application by using the DataReader to return your data in a forward-only, read-only manner. Although the DataAdapter uses the DataReader to fill the contents of a DataSet (see Populating a DataSet from a DataAdapter (ADO.NET)[^]), by using the DataReader, you can boost performance because you will save memory that would be consumed by the DataSet, and avoid the processing that is required to create and fill the contents of the DataSet.


这篇关于我应该在哪里使用模式连接和断开连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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