all groups > sql server programming > november 2006 >
You're in the

sql server programming

group:

SQL 2005 Express and multiple connection on VB.NET application


Re: SQL 2005 Express and multiple connection on VB.NET application Arnie Rowland
11/22/2006 2:54:34 PM
sql server programming:
Extend the connection timeout value in the Connection object.

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous

You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf


[quoted text, click to view]

Re: SQL 2005 Express and multiple connection on VB.NET application Arnie Rowland
11/22/2006 2:54:34 PM
Extend the connection timeout value in the Connection object.

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous

You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf


[quoted text, click to view]

Re: SQL 2005 Express and multiple connection on VB.NET application Norman Yuan
11/22/2006 5:20:14 PM
You did not indicate what kind of processes (CalculateValue1...10 and
UpdateValues) inside the loop are, are they time-consuming processes? If
they are, you'd better not put these processes inside a DataReader's Read()
loop. I'd recommend you re-structure it this way:

OpenConnection
Open DataReader
Read all data from DB into a data structure, such as array, list or
collection
Close Reader
Close Connection

Loop through the Data Structure
Call CalculateValue1
...
UpdateValues
End Loop

With this structure, your app only open one connection when needed and close
it whenever the access to DB is done, as opposed to your original structure,
where a connection is kept open during lengthy processing and your app at
least need two connections to loop through.


[quoted text, click to view]

Re: SQL 2005 Express and multiple connection on VB.NET application David Browne
11/22/2006 5:40:29 PM


[quoted text, click to view]

I suspect you are timining out on locks held by your DataReader. Use a
DataTable instead of a DataReader to create a disconnected, client-side set
of rows. Then when you iterate over the rows you won't have an open
connection or own locks in the database.

David
SQL 2005 Express and multiple connection on VB.NET application Bonato Pierantonio
11/22/2006 11:35:43 PM
Hi all,
I have a problem that I cannot resolve. I try yo explaim my scenario:
There is an application deveoped in VB.NET
I have a cycle the LOOP on a DataReader inside the cycle there is some like
this
OpenConnection
do while Dr.Read <-- for several record, I suppose some like 100/150
call CalculateValue1
call CalculateValue2
...
call CalculateValue10

call UpdateValues
LOOP
Close Connection

Where the function CalculateValueX is some like this
Open Connection
Execute Command
Close Connection

and similar the UpdateValues
OpenConnection
execute cmd "UPDATE (a,b,c) VALUES (1,2,3)
CloseConnection

The problem is that 1 times each 3 or 4 during the UPDATE command the Sql
give me an error TIMEOUT EXPIRED EXECUTING COMMAND

Only for test I try to use a different connectionstring on the UPDATE
COMMAND (so it doesn't use the Pool Connection) and it seems to work bette
use thir. But I cannot this connectionString in the real deployment.

Please someone can help me???

AddThis Social Bookmark Button