VB.NET中的多用户应用程序? [英] Multi User Application in VB.NET?

查看:84
本文介绍了VB.NET中的多用户应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我创建了一个应用程序VS 2008和SQL SERVER 2005作为后端.在数据库中,我有一些主键,但是它们都是自动生成的,因为我确实拥有该数据库的Identity选项.现在,我想使其成为多用户.因此,我该怎么办?我是否需要为多用户更改数据库?因为我已经在内置的自动生成选项中使用过,它是否需要针对多用户环境的表或行级别锁定?如果它不需要表或行级别的锁,那么如果我将应用程序的EXE放在局域网上连接的不同机器上,是否需要对数据库连接字符串进行任何更改?我已将连接字符串放在应用程序的app.config文件中.

如果有人对此有所了解,请帮助我....

谢谢

Hi,

I have created one application VS 2008 and SQL SERVER 2005 as backend. In database i have some primary key but they all are auto generated as I have true the Identity option of database in that. Now i would like to make it as multiuser. So for that what should i do? Does i need to change the database for multi user or not? Because i have used in built auto generate option does it require table or row level locking for mulit user environment or not? If it does not require table or row level locks then if i put the EXE of the application on different machines connected on LAN, is it require any change in database connection string? I have putted connection string in app.config file of my application.

Please help me if anyone has knowledge about this....

Thank you

推荐答案

您可能需要更改连接字符串,但如果它们都连接在同一LAN上和同一域(MSHOME或WORKGROUP)中,则可能不需要往往是默认值).无论如何,这应该在您的app.config文件中,这样就不会有问题.

如果将身份字段用作主键,则数据库将为其分配它们,并且在输入新记录时无需进行任何锁定.但是,当您使用UPDATE命令时,您可能需要进行行锁定,如果要插入或更新一组记录,请考虑使用事务.

否则,MsSQL应该在不引起注意的情况下处理多用户,直到您吸引到大量用户为止.
You may need to change the connection string, but probably not if they are all connected on the same LAN and in the same domain (MSHOME, or WORKGROUP tend to be the defaults). In any case, this should be in you app.config file, so that should not be a problem.

If you are using Identity fields as your Primary Key then the database will assign them and there should be no need to do any locking when entering new records. You may want to do row locking when you use UPDATE commands though, and consider using transactions if you are inserting or updating a group of records.

Otherwise, MsSQL should handle multi-user without you noticing, until you get to significant numbers of users, that is!


Sql Server本质上是一个多用户数据库.除非您有意将数据库置于单用户模式,否则其他用户可以连接到该数据库.

连接字符串定义如何从您的计算机中查找Sql Server.因此,很可能您必须更改连接字符串以包括新的服务器名称.有关连接字符串的信息,请参见: http://www.connectionstrings.com/sql-server-2008 [ ^ ]

锁定是一个很大的领域,一开始您应该注意的部分是交易.锁定将自动为您处理.看看这个 http://en.wikipedia.org/wiki/ACID_transactions [
Sql Server is a multi user database by nature. Unless you have deliberately put the database into single user mode other users can connect to it.

The connection string defines how to find the Sql Server from your machine. So most likely you have to change the connection string to include the new server name. For info about connection strings, see: http://www.connectionstrings.com/sql-server-2008[^]

Locking is a big area and the part you should take care of in the beginning is transactions. Locking is handled automatically for you. Have a look at this http://en.wikipedia.org/wiki/ACID_transactions[^]. That would give some basic info about transaction handling.


这篇关于VB.NET中的多用户应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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