473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

microsoft.applicationblock.data DLL (.net2.0) causing sql timeout error

hi there,

i;m doing a loop of a few hundred records and inserting into database using
the MS data dll, and the following line

dim sql as string = "mysql code is here..."
microsoft.applicationblocks.data.sqlhelper.execute nonquery(configurationsettings.appsetting("db"),co mmandtype.text,sql)

After a large number of records, i see its not closing the sql process, and
the process remain in "sleeping" mode.
How can i fix this?

thanks,
Paul
Nov 16 '06 #1
6 5643
Paul,
Give the Enterprise Library a try. I found the data block in that to
be much more stable. It's very similar and more neutral than the older
applicationblocks.

http://practices.gotdotnet.com/projects/entlib

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Milsnips" <mi******@hotmail.comwrote in message
news:Oz**************@TK2MSFTNGP03.phx.gbl...
hi there,

i;m doing a loop of a few hundred records and inserting into database
using the MS data dll, and the following line

dim sql as string = "mysql code is here..."
microsoft.applicationblocks.data.sqlhelper.execute nonquery(configurationsettings.appsetting("db"),co mmandtype.text,sql)

After a large number of records, i see its not closing the sql process,
and the process remain in "sleeping" mode.
How can i fix this?

thanks,
Paul


Nov 16 '06 #2
Ok, will give it a try

i just did another test with the my code, and instead of using the
application block, i created the connection and sqlcommand objects,
executenonquery, then closed, disposed and set both objects to nothing,

Dim cn As New SqlConnection(SharedFunctions.db)
Dim cmd As New SqlCommand(sql.ToString, cn)
Try
cn.Open()
cmd.ExecuteNonQuery()
Catch ex As SqlException
'error occured
Finally
cmd.Dispose()
cmd = Nothing
If cn.State = Data.ConnectionState.Open Then cn.Close()
cn.Dispose()
cn = Nothing
End Try

after about approx. 150+ records, the error still occured, im trying to
import data from a CSV file via web that has up to 500-2000 records.

thanks,
Paul
"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:OC***************@TK2MSFTNGP06.phx.gbl...
Paul,
Give the Enterprise Library a try. I found the data block in that
to be much more stable. It's very similar and more neutral than the older
applicationblocks.

http://practices.gotdotnet.com/projects/entlib

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Milsnips" <mi******@hotmail.comwrote in message
news:Oz**************@TK2MSFTNGP03.phx.gbl...
>hi there,

i;m doing a loop of a few hundred records and inserting into database
using the MS data dll, and the following line

dim sql as string = "mysql code is here..."
microsoft.applicationblocks.data.sqlhelper.execut enonquery(configurationsettings.appsetting("db"),c ommandtype.text,sql)

After a large number of records, i see its not closing the sql process,
and the process remain in "sleeping" mode.
How can i fix this?

thanks,
Paul



Nov 16 '06 #3
Your post title is somewhat misleading - are you REALLY getting a sql
timeout, or are you just seeing the SQL process in Enterprise Manager
"Sleeping".
If #2, that is normal, and has nothing to do with timeouts.
As long as you are closing your ADO.NET SqlConnection object after each
"call" you should be fine.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Milsnips" wrote:
hi there,

i;m doing a loop of a few hundred records and inserting into database using
the MS data dll, and the following line

dim sql as string = "mysql code is here..."
microsoft.applicationblocks.data.sqlhelper.execute nonquery(configurationsettings.appsetting("db"),co mmandtype.text,sql)

After a large number of records, i see its not closing the sql process, and
the process remain in "sleeping" mode.
How can i fix this?

thanks,
Paul
Nov 16 '06 #4
Hi Peter,

I tried a number of ways, and what happens is it creates about 150 or so sql
process, and then throws the error saying connection pool max. reached.

What i'm using is the line,
Microsoft.ApplicationBlocks.Data.SqlHelper.Execute NonQuery, so i dont have
an object to close/dispose.

Also, i did the full code with sqlconection, sqlcommand, and so on, did
executenonquery, then closed and disposed all objects and it still appears
to be happening. Bear in mind, my web page uploads a CSV file, and on button
click, it reads in the file, and tries importing/updating about 2000 records
on one postback.

thanks,
Paul
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:4C**********************************@microsof t.com...
Your post title is somewhat misleading - are you REALLY getting a sql
timeout, or are you just seeing the SQL process in Enterprise Manager
"Sleeping".
If #2, that is normal, and has nothing to do with timeouts.
As long as you are closing your ADO.NET SqlConnection object after each
"call" you should be fine.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Milsnips" wrote:
>hi there,

i;m doing a loop of a few hundred records and inserting into database
using
the MS data dll, and the following line

dim sql as string = "mysql code is here..."
microsoft.applicationblocks.data.sqlhelper.execut enonquery(configurationsettings.appsetting("db"),c ommandtype.text,sql)

After a large number of records, i see its not closing the sql process,
and
the process remain in "sleeping" mode.
How can i fix this?

thanks,
Paul

Nov 17 '06 #5
OK. If you are doing 150, that's enough to bomb out the connection pool which
holds 100 by default. So what is happening is that you are creating new
connections but they aren't getting closed / disposed.

The SqlHelper ExecuteNonQuery method has a number of overloads, one of which
allows you to pass in your own SqlConnection. So in the line after the
ExecuteNonQuery, you should call the .Close() method on your connection, and
that should take care of it.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Milsnips" wrote:
Hi Peter,

I tried a number of ways, and what happens is it creates about 150 or so sql
process, and then throws the error saying connection pool max. reached.

What i'm using is the line,
Microsoft.ApplicationBlocks.Data.SqlHelper.Execute NonQuery, so i dont have
an object to close/dispose.

Also, i did the full code with sqlconection, sqlcommand, and so on, did
executenonquery, then closed and disposed all objects and it still appears
to be happening. Bear in mind, my web page uploads a CSV file, and on button
click, it reads in the file, and tries importing/updating about 2000 records
on one postback.

thanks,
Paul
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:4C**********************************@microsof t.com...
Your post title is somewhat misleading - are you REALLY getting a sql
timeout, or are you just seeing the SQL process in Enterprise Manager
"Sleeping".
If #2, that is normal, and has nothing to do with timeouts.
As long as you are closing your ADO.NET SqlConnection object after each
"call" you should be fine.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Milsnips" wrote:
hi there,

i;m doing a loop of a few hundred records and inserting into database
using
the MS data dll, and the following line

dim sql as string = "mysql code is here..."
microsoft.applicationblocks.data.sqlhelper.execute nonquery(configurationsettings.appsetting("db"),co mmandtype.text,sql)

After a large number of records, i see its not closing the sql process,
and
the process remain in "sleeping" mode.
How can i fix this?

thanks,
Paul


Nov 17 '06 #6
Thanks for the reply peter, i'll give that a try.

regards,
Paul

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:38**********************************@microsof t.com...
OK. If you are doing 150, that's enough to bomb out the connection pool
which
holds 100 by default. So what is happening is that you are creating new
connections but they aren't getting closed / disposed.

The SqlHelper ExecuteNonQuery method has a number of overloads, one of
which
allows you to pass in your own SqlConnection. So in the line after the
ExecuteNonQuery, you should call the .Close() method on your connection,
and
that should take care of it.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Milsnips" wrote:
>Hi Peter,

I tried a number of ways, and what happens is it creates about 150 or so
sql
process, and then throws the error saying connection pool max. reached.

What i'm using is the line,
Microsoft.ApplicationBlocks.Data.SqlHelper.Execut eNonQuery, so i dont
have
an object to close/dispose.

Also, i did the full code with sqlconection, sqlcommand, and so on, did
executenonquery, then closed and disposed all objects and it still
appears
to be happening. Bear in mind, my web page uploads a CSV file, and on
button
click, it reads in the file, and tries importing/updating about 2000
records
on one postback.

thanks,
Paul
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in
message
news:4C**********************************@microso ft.com...
Your post title is somewhat misleading - are you REALLY getting a sql
timeout, or are you just seeing the SQL process in Enterprise Manager
"Sleeping".
If #2, that is normal, and has nothing to do with timeouts.
As long as you are closing your ADO.NET SqlConnection object after each
"call" you should be fine.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Milsnips" wrote:

hi there,

i;m doing a loop of a few hundred records and inserting into database
using
the MS data dll, and the following line

dim sql as string = "mysql code is here..."
microsoft.applicationblocks.data.sqlhelper.execut enonquery(configurationsettings.appsetting("db"),c ommandtype.text,sql)

After a large number of records, i see its not closing the sql
process,
and
the process remain in "sleeping" mode.
How can i fix this?

thanks,
Paul



Nov 17 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mathieu Blais | last post by:
Hi, I need to capture the Script timeout error if that is possible. I know I can increase the timeout value in the server settings or in the scripts itself but I really want to make sure that no...
3
by: rkbnair | last post by:
Intermittently, I get the foloing error at my page. Microsoft OLE DB Provider for ODBC Drivers error '80004005' Timeout expired /AnomalyMain.asp, line 1247 I tried increasing the timeout...
0
by: Ersin Gençtürk | last post by:
we are getting : System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period...
3
by: DougS | last post by:
We have an ASP.Net (framework 1.1) app that does a lot of database reads and updates. The app has a dozen pages and we're about 90% done and all of a sudden I'm getting this error: Timeout...
2
by: Daniel | last post by:
update/insert with microsoft.xml.xquery(.net2.0beta) can anyone provide an example of how to update/insert with microsoft.xml.xquery?
3
by: Raj | last post by:
Hi, I'm getting the Timeout error in one of my ASP application. I'm calling a slight complex stored procedure which is taking bet 35 to 40 seconds when run in the backend which is not bad. But...
6
by: Martin Eyles | last post by:
I am trying to perform a very long query on an MSSQL database, using ASP.NET, and making the code behind in VB.NET. I have been receiving timeout error, so I thought I would add Connect Timeout to...
4
by: =?Utf-8?B?VGVycmFuY2U=?= | last post by:
I have an application that runs fine on my machine(of course) that access the local Sql Server. However, when trying to run this application from another machine I receive a Sql timeout error. I...
1
by: =?Utf-8?B?QW5kcmV3?= | last post by:
Hello, friends, Our have a .net 2003 website using c#.net. We want to let our users to have longer timeout time, and we did in Web.config: <authentication mode="Forms"> <forms...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.