473,698 Members | 2,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

microsoft.appli cationblock.dat a 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.appli cationblocks.da ta.sqlhelper.ex ecutenonquery(c onfigurationset tings.appsettin g("db"),command type.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 5662
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
applicationbloc ks.

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

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

"Milsnips" <mi******@hotma il.comwrote in message
news:Oz******** ******@TK2MSFTN GP03.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.appli cationblocks.da ta.sqlhelper.ex ecutenonquery(c onfigurationset tings.appsettin g("db"),command type.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(S haredFunctions. db)
Dim cmd As New SqlCommand(sql. ToString, cn)
Try
cn.Open()
cmd.ExecuteNonQ uery()
Catch ex As SqlException
'error occured
Finally
cmd.Dispose()
cmd = Nothing
If cn.State = Data.Connection State.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******@fitzm e.comwrote in message
news:OC******** *******@TK2MSFT NGP06.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
applicationbloc ks.

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

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

"Milsnips" <mi******@hotma il.comwrote in message
news:Oz******** ******@TK2MSFTN GP03.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.appl icationblocks.d ata.sqlhelper.e xecutenonquery( configurationse ttings.appsetti ng("db"),comman dtype.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.appli cationblocks.da ta.sqlhelper.ex ecutenonquery(c onfigurationset tings.appsettin g("db"),command type.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.Appli cationBlocks.Da ta.SqlHelper.Ex ecuteNonQuery, 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*******@yaho o.nospammin.com wrote in message
news:4C******** *************** ***********@mic rosoft.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.appl icationblocks.d ata.sqlhelper.e xecutenonquery( configurationse ttings.appsetti ng("db"),comman dtype.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.Appli cationBlocks.Da ta.SqlHelper.Ex ecuteNonQuery, 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*******@yaho o.nospammin.com wrote in message
news:4C******** *************** ***********@mic rosoft.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.appli cationblocks.da ta.sqlhelper.ex ecutenonquery(c onfigurationset tings.appsettin g("db"),command type.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*******@yaho o.nospammin.com wrote in message
news:38******** *************** ***********@mic rosoft.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.Appl icationBlocks.D ata.SqlHelper.E xecuteNonQuery, so i dont
have
an object to close/dispose.

Also, i did the full code with sqlconection, sqlcommand, and so on, did
executenonquer y, 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*******@yaho o.nospammin.com wrote in
message
news:4C******* *************** ************@mi crosoft.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.appl icationblocks.d ata.sqlhelper.e xecutenonquery( configurationse ttings.appsetti ng("db"),comman dtype.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
7035
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 timeout situation will results as the standard script timeout error page. Can we do this ?? Help please.
3
356
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 value and still it does this.
0
4095
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 elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at...
3
452
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 expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. It's not happening in the same place each time. I added the max pool...
2
2268
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
2060
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 when it is called from the ASP code it is giving the following error message: Microsoft OLE DB Provider for SQL Server error '80040e31' Timeout expired
6
7776
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 my connection string. However this appears to have no effect. The connection string is set up as follows Dim conn As New SqlClient.SqlConnection("Data Source=serverName; User ID=userName; Password=password; Connect Timeout=9999") Any ideas...
4
3060
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 thought it was my stored procedure but that doesn't seem to be the case. The following are the connection strings that I've tried: //private string connstring = "integrated security=SSPI;data source=<ip address>;" // "persist security...
1
1245
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 loginUrl="login.aspx" protection="All" name="Cookie" slidingExpiration="true" timeout="120" />
0
8600
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9021
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4361
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.