473,322 Members | 1,714 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,322 software developers and data experts.

SQLException timeout with nested Queries

Hi All,
I have a problem with nested SQLQueries. I will give here an abstract
sample of code which I wrote

Method A
{
createSqlTransaction and
call SQL Insert Statement including "Select ScopeIdentity();"
try
{
call Method B
}
catch
{
Rollback Transaction
}
}

Method B
{
call another SQL Insert Statement including "Select ScopeIdentity();"
....
}
In "Method B" I get an SQLException with a Timeout Errormessage.

Can somebody help me?

Thanks in advance.

Jun 1 '06 #1
2 1935
Does it indicate what kind of timeout it is? Is it a timeout on the
transaction, or a timeout on the command?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Ge***********@web.de> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
Hi All,
I have a problem with nested SQLQueries. I will give here an abstract
sample of code which I wrote

Method A
{
createSqlTransaction and
call SQL Insert Statement including "Select ScopeIdentity();"
try
{
call Method B
}
catch
{
Rollback Transaction
}
}

Method B
{
call another SQL Insert Statement including "Select ScopeIdentity();"
...
}
In "Method B" I get an SQLException with a Timeout Errormessage.

Can somebody help me?

Thanks in advance.

Jun 1 '06 #2
It was a timeout on the SqlCommand object. I found out, that Sql-Server
can not handle nested transactions. The solution was to create an
SqlCommand object and bind a transaction to it. Then I assign the
SqlCommand object via reference to other methods where i can reuse the
object and in errorcase can rollback the transaction.

I just have to keep in mind to close the connection in the parent
method.

Thanks for all answers!

Greetings

Gerrit Horeis

--
Software Developer
http://www.xira.de
http://www.ci-gate.de

Jun 9 '06 #3

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

Similar topics

3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
4
by: hb | last post by:
Hi, I got the "System.Data.SqlClient.SqlException: Timeout expired. " error on my web application while saving some data. Would you please tell me how to change the settings in SQL Server...
3
by: Matt | last post by:
I'm having an issue with returning a large amount of data into a dataset. When the query returns thousands of lines of data (in Query Analyzer it can take 2 minutes) I receive the following error:...
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...
4
by: Stephen Noronha | last post by:
Hi, I have an unusual error, "System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding......and so on...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
7
by: bylum | last post by:
Servlet SQLException Communication link failure java howto i can't connect jsp and database(mysql). This is the exception: exception org.apache.jasper.JasperException:...
22
by: Nick Craig-Wood | last post by:
Did anyone write a contextmanager implementing a timeout for python2.5? I'd love to be able to write something like with timeout(5.0) as exceeded: some_long_running_stuff() if exceeded:...
2
by: rajasoorya | last post by:
Hi, In my application.... i want to identify whther the SQLException caught is a Timeout or any other SQLException. The reason being, i have to show a different msg to the user in case it is a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.