全球联系 [英] global connections

查看:98
本文介绍了全球联系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将VB6应用程序转换为C#,VB6应用程序有1个连接和3个

记录集,全部全局并且一直打开以便所有必需的

程序可以使用它们。使用C#,最好是拥有一个全局的

连接和数据引导器等,或者将所有数据库内容

放入一个单独的类并调用每当我需要

读取/修改数据?


任何建议都会非常感激。

干杯,

Mike


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!

I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
recordsets, all global and open all the time so that all the required
procedures can use them. Using C#, would it be best to have a global
connection and datareaders etc, or is it better to put all the db stuff
into a seperate class and make calls to this whenever I need to
read/amend data?

Any advice would be really appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!

推荐答案

Mike,


连接打开数据库并不是一件好事。

如果有的话,你应该在需要时打开和关闭它。


一般来说,抽象出数据访问是个好主意

东西。这样,您就可以创建一个管道,您的所有数据将通过该管道流动。这是一件好事,因为你所做的任何改变都会在任何地方传播(而不是你必须四处走动,而且你自己会改变一切)。


希望这会有所帮助。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com

" Mike P" < mr*@telcoelectronics.co.uk>在消息中写道

news:ef ************** @ tk2msftngp13.phx.gbl ...
Mike,

Having a connection open all the time to a database is not a good thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:ef**************@tk2msftngp13.phx.gbl...
我正在转换一个VB6应用程序到C#和VB6应用程序有1个连接和3个记录集,所有全局和打开所有时间,以便所有必需的程序可以使用它们。使用C#,最好是拥有一个全局的连接和数据读取器等,或者最好将所有数据库内容放入一个单独的类中,并在需要时调用它
阅读/修改数据?

任何建议都会非常感激。

干杯,

迈克

** *通过开发人员指南 http://www.developersdex.com 发送***
不要只是参加USENET ......获得奖励!
I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
recordsets, all global and open all the time so that all the required
procedures can use them. Using C#, would it be best to have a global
connection and datareaders etc, or is it better to put all the db stuff
into a seperate class and make calls to this whenever I need to
read/amend data?

Any advice would be really appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



我认为对于客户端 - 服务器应用程序(假设''什么这个VB6应用程序

最有可能),全局连接实际上是有意义的。既然你不能在这种情况下充分利用连接池,并且打开

并且一直关闭物理连接的成本太高。


同意数据访问的东西仍然应该被抽象出来。


Nicholas Paldino [.NET / C#MVP]"写道:
I would think that for a client-server app (assuming that''s what this VB6 app
is most likely), global connection actually make sense. since you can''t
really take advantage of connection pooling in this situation, and opening
and closing physical connections all the time is too costly.

agree that data access stuff should still be abstracted out regardless.

"Nicholas Paldino [.NET/C# MVP]" wrote:
迈克,

连接打开数据库是不是一件好事。
如果有的话,你应该是在需要时打开和关闭它。

一般来说,抽象出数据访问的东西是个好主意。这样,您就可以创建一个管道,您的所有数据访问都将通过该管道流动。这是一件好事,因为你所做的任何改变都会在任何地方传播(而不是你必须四处走动并且自己改变一切)。

希望这会有所帮助。

-
- Nicholas Paldino [.NET / C#MVP]
- mv *@spam.guard.caspershouse.com

Mike P < mr*@telcoelectronics.co.uk>在消息中写道
新闻:ef ************** @tk2msftngp13.phx.gbl ...
Mike,

Having a connection open all the time to a database is not a good thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:ef**************@tk2msftngp13.phx.gbl...
我正在将VB6应用程序转换为C#和VB6应用程序有1个连接和3个记录集,全部全局并且一直打开,以便所有必需的程序可以使用它们。使用C#,最好是拥有一个全局的连接和数据读取器等,或者最好将所有数据库内容放入一个单独的类中,并在需要时调用它
阅读/修改数据?

任何建议都会非常感激。

干杯,

迈克

** *通过开发人员指南 http://www.developersdex.com 发送***
不要只是参加USENET ......获得奖励!
I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
recordsets, all global and open all the time so that all the required
procedures can use them. Using C#, would it be best to have a global
connection and datareaders etc, or is it better to put all the db stuff
into a seperate class and make calls to this whenever I need to
read/amend data?

Any advice would be really appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!




Daniel,


为什么你不能在这种情况下利用连接池?


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


Daniel Jin <沓******* @ discussions.microsoft.com>在消息中写道

新闻:02 ********************************** @ microsof t.com ...
Daniel,

Why can''t you take advantage of connection pooling in this situation?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel Jin" <Da*******@discussions.microsoft.com> wrote in message
news:02**********************************@microsof t.com...
我认为对于客户端 - 服务器应用程序(假设这是最有可能的VB6
应用程序),实际上是全局连接合理。因为在这种情况下你不能真正利用连接池,而且打开
和关闭物理连接总是太昂贵了。

同意数据访问的东西无论如何都应该抽象出来。

Nicholas Paldino [.NET / C#MVP]"写道:
I would think that for a client-server app (assuming that''s what this VB6
app
is most likely), global connection actually make sense. since you can''t
really take advantage of connection pooling in this situation, and opening
and closing physical connections all the time is too costly.

agree that data access stuff should still be abstracted out regardless.

"Nicholas Paldino [.NET/C# MVP]" wrote:
迈克,

有一个连接打开一直到数据库是不是一件好事。
如果有的话,你应该在需要时打开和关闭它。

一般来说,抽象出数据访问的东西是个好主意。这样,您就可以创建一个管道,您的所有数据访问都将通过该管道流动。这是一件好事,因为你所做的任何改变都会在任何地方传播(而不是你必须四处走动

自己改变一切)。
希望这会有所帮助。

-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com

Mike P < mr*@telcoelectronics.co.uk>在消息中写道
新闻:ef ************** @ tk2msftngp13.phx.gbl ...
Mike,

Having a connection open all the time to a database is not a good
thing.
If anything, you should be opening and closing it when you need it.

In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around
and
change everything yourself).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:ef**************@tk2msftngp13.phx.gbl...
>我正在将VB6应用转换为C#和VB6应用程序有1个连接和3
>记录集,全部全局和开放,以便所有必需的
>程序可以使用它们。使用C#,最好有一个全球性的
>连接和数据集市等,或者更好地放入所有数据库内容
>进入一个单独的班级,并在我需要时打电话给
>阅读/修改数据?
>
>任何建议都会非常感激。
>
>
>干杯,
>
>迈克
>
>
>
> ***通过开发人员指南 http://www.developersdex.com 发送***
>不要只是参加USENET ......获得奖励!
>I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
> recordsets, all global and open all the time so that all the required
> procedures can use them. Using C#, would it be best to have a global
> connection and datareaders etc, or is it better to put all the db stuff
> into a seperate class and make calls to this whenever I need to
> read/amend data?
>
> Any advice would be really appreciated.
>
>
> Cheers,
>
> Mike
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don''t just participate in USENET...get rewarded for it!




这篇关于全球联系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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