Proper use of a database connection

I have a Winforms program that connects to SQL Server 2008.

There are 100 users who connect to this database and

run a search query -> and update the database.

I open the connection when the program starts and closes when the program ends.

Is this right to do?

Is it better to open a connection β†’ execute a query β†’ update β†’ and close the connection?

Thanks in advance

+3
source share
3 answers

is it better to open a connection β†’ execute a query β†’ update β†’ and close the connection?

, SQL Server ADO.Net. , , , . SQL .

MSDN ( ):

, , .

+4

, , .

, β†’ SQL β†’ Close.

. ( ), .

+4

, . , . , , , .

0

Source: https://habr.com/ru/post/1777087/


All Articles