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

sqlcommand.BeginExecuteReader ignores CommandTimeout

The following finishes in 1 hour instead of erroring after 1 second as
expected.

Dim cn As New System.Data.SqlClient.SqlConnection
cn.ConnectionString = "Server=(local); Database=master; User ID=sa;
Password=passwd; Asynchronous Processing=true;"
cn.Open()

Dim sqlcommand As New System.Data.SqlClient.SqlCommand
sqlcommand.Connection = cn
sqlcommand.CommandTimeout = 1
sqlcommand.CommandText = "waitfor delay '01:00:00'"
Dim iasyncresult As System.IAsyncResult =
sqlcommand.BeginExecuteReader()
While Not iasyncresult.IsCompleted
System.Threading.Thread.Sleep(1000)
End While

'Note: the following correctly errors after 1 second
'sqlcommand.ExecuteReader()
Nov 8 '07 #1
0 2469

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

Similar topics

1
by: Tim Meagher | last post by:
I am running ASP code that was migrated from a Windows 2000 Server to a Windows 2003 server. For some reason the connection timeout or command timeout are getting ignored and my query time sout...
10
by: Henrik Dahl | last post by:
Hello! After I've finished using an instance of the SqlCommand class, should I then invoke Dispose() on the instance. I suppose so, as there is a Dispose method, but what does it actually...
2
by: Andre Ranieri | last post by:
I'm having trouble with what should be a simple task; beginning and committing T-SQL transactions using the SQLClient. I'm using a SqlCommand (cmd) to begin the transaction and delete records from...
5
by: tascien | last post by:
Hi, when i use this code: SqlConn.Open() SqlCmd.Connection = SqlConn SqlCmd.CommandText = sqlCommand If Not CmdTimeOut < 0 Then SqlCmd.CommandTimeout = CmdTimeOut Dim ret =...
12
by: Piotrek | last post by:
HI all. In my web site I have some ObjetDataSource. Its business object property is set to my dataset I created in dataset designer (this dataset has table adapter). My question is: how can I...
4
by: Piotrek | last post by:
Hi all. I am developing some web application in which I use datasets, which were generated using dataSetDesigner. My dataset has a TableAdapter, which has GetData method. Users of my application...
5
by: Robert Bravery | last post by:
HI all, Whats the differe between useing Executereader() and Beginexecutereader()...endexecutereader() for asyncronys running of a SP Thanks Robert
1
by: UnglueD | last post by:
Hello, I have an application that grabs data through use of a strongly typed XSD. However, in doing so, I am wondering if I have lost the ability to set the CommandTimeout on the command object...
1
by: job | last post by:
how is it possible to serialize/de-serialize a SqlCommand?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.