OleDbConnection对象该怎么做才能获得最佳性能 [英] What to do get best performance by OleDbConnection object

查看:89
本文介绍了OleDbConnection对象该怎么做才能获得最佳性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是最好的:(OleDbConnection)
1)一个Closed Connection对象分配给一个全局变量,并在需要时将其打开

2)一个Opened Connection对象分配给一个全局变量,并将其保留在整个应用程序中

3)每次创建一个新的本地Connection对象并在使用后将其关闭

4)其他建议

主要目标:最佳性能

What performs best: (OleDbConnection)
1) A Closed Connection object assign to a global variable and Open it when need
Or
2) A Opened Connection object assign to a global variable and keep it throughout the application
Or
3) Everytime creates a new local Connection object and close it after use
Or
4) Anything other suggestion(s)

The main objectives: The best ferformance

推荐答案

每次创建一个新的本地Connection对象,并在使用后将其关闭.

这是一个作业问题.这是为了告诉您创建连接对象的方式,这样就不会造成内存泄漏.因此,将其保持在本地状态并在需要时打开,并在使用后关闭是减少连接问题的最佳方法.
Every time creates a new local Connection object and close it after use.

This is a homework question. This was given to you to tell what is way to create the connection object such that there is no memory leakage. Thus, keeping it local and open when needed and close after use is the best way to make least memory issue because of open connection.


这篇关于OleDbConnection对象该怎么做才能获得最佳性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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