473,804 Members | 3,941 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Reader Again

Hi,

I am getting the below mentioned error when I try to update a table
Exception: Unable to update Person records Exception : System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

I have also set checked the time out of the server to unlimited. I am using the SQLDataReader in my applciation at quite a few palces and make it a point to close the object and set it to nothing.
Here is the snippet of the code.

SqlDataReader lobj_PersonTabl e = SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

while(lobj_Pers onTable.Read())
{

}

lobj_CompanyTab le.Close();
lobj_CompanyTab le = null;

But if I check the SQL server enterprise manager, I find a number of locks/Process Id under current activity. I feel that its these locks that might be preventing the update statement from executing. Am I missing something here?

Any help would be appreciated.

Thanks and Regards,
Saurabh

Jul 22 '06 #1
8 1697
Looking at your code snippet, I'm not too sure where you are trying to update the table.
Is this within the while loop?
Do you use the same connection object as the one for the DataReader?

If so, here is the problem! Normally a connection currently in use by a dataReader is not available for any other activity...
You have either to use another one or close the dataReader first.

- José
"Saurabh" <sa***********@ hotmail.coma écrit dans le message de news: OF************* *@TK2MSFTNGP05. phx.gbl...
Hi,

I am getting the below mentioned error when I try to update a table
Exception: Unable to update Person records Exception : System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.



I have also set checked the time out of the server to unlimited. I am using the SQLDataReader in my applciation at quite a few palces and make it a point to close the object and set it to nothing.
Here is the snippet of the code.

SqlDataReader lobj_PersonTabl e = SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

while(lobj_Pers onTable.Read())
{

}

lobj_CompanyTab le.Close();
lobj_CompanyTab le = null;

But if I check the SQL server enterprise manager, I find a number of locks/Process Id under current activity. I feel that its these locks that might be preventing the update statement from executing. Am I missing something here?

Any help would be appreciated.

Thanks and Regards,
Saurabh

Jul 22 '06 #2
I can't figure out what you mean by "I have also set checked the time out of
the server to unlimited". By "the server" I assume you mean the SQL Server.
But "the time out of the server" means nothing. The SQL Server has no
timeout property. For example, if I have 10 clocks in my house, and I tell
you that I "set the time of my house," which of the 10 clocks did I set?

Can you be more specific?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.

"Saurabh" <sa***********@ hotmail.comwrot e in message
news:OF******** ******@TK2MSFTN GP05.phx.gbl...
Hi,

I am getting the below mentioned error when I try to update a table
Exception: Unable to update Person records Exception :
System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not
responding.

I have also set checked the time out of the server to unlimited. I am using
the SQLDataReader in my applciation at quite a few palces and make it a
point to close the object and set it to nothing.
Here is the snippet of the code.

SqlDataReader lobj_PersonTabl e =
SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

while(lobj_Pers onTable.Read())
{

}

lobj_CompanyTab le.Close();
lobj_CompanyTab le = null;

But if I check the SQL server enterprise manager, I find a number of
locks/Process Id under current activity. I feel that its these locks that
might be preventing the update statement from executing. Am I missing
something here?

Any help would be appreciated.

Thanks and Regards,
Saurabh
Jul 22 '06 #3
Hi,

Sorry I did not explain the issue correctly.

Here I am setting the SQLDataReader object to read from a table
SqlDataReader lobj_PersonTabl e = SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

Now the next line of code is the while loop
while(lobj_Pers onTable.Read())
{

}

Now it is withn this loop that I am executing an update statement using Command object. It is this loop that I am encountering a "time out exception" for every record in the loop. Here is the text
Exception: Unable to update Person records Exception : System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Please let me know If you need anything else.

Thanks and Regards,
Saurabh

"José Joye" <jo************ *************** **********@blue win.chwrote in message news:u5******** ******@TK2MSFTN GP02.phx.gbl...
Looking at your code snippet, I'm not too sure where you are trying to update the table.
Is this within the while loop?
Do you use the same connection object as the one for the DataReader?

If so, here is the problem! Normally a connection currently in use by a dataReader is not available for any other activity...
You have either to use another one or close the dataReader first.

- José
"Saurabh" <sa***********@ hotmail.coma écrit dans le message de news: OF************* *@TK2MSFTNGP05. phx.gbl...
Hi,

I am getting the below mentioned error when I try to update a table
Exception: Unable to update Person records Exception : System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.



I have also set checked the time out of the server to unlimited. I am using the SQLDataReader in my applciation at quite a few palces and make it a point to close the object and set it to nothing.
Here is the snippet of the code.

SqlDataReader lobj_PersonTabl e = SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

while(lobj_Pers onTable.Read())
{

}

lobj_CompanyTab le.Close();
lobj_CompanyTab le = null;

But if I check the SQL server enterprise manager, I find a number of locks/Process Id under current activity. I feel that its these locks that might be preventing the update statement from executing. Am I missing something here?

Any help would be appreciated.

Thanks and Regards,
Saurabh

Jul 22 '06 #4
Hi,

Sorry I did not explain the issue correctly.

Here I am setting the SQLDataReader object to read from a table
SqlDataReader lobj_PersonTabl e =
SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

Now the next line of code is the while loop
while(lobj_Pers onTable.Read())
{

}

Now it is withn this loop that I am executing an update statement using
Command object. It is this loop that I am encountering a "time out
exception" for every record in the loop. Here is the text
Exception: Unable to update Person records Exception :
System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not
responding.

Please let me know If you need anything else.

Thanks and Regards,
Saurabh
"Kevin Spencer" <uc*@ftc.govwro te in message
news:O7******** ******@TK2MSFTN GP02.phx.gbl...
I can't figure out what you mean by "I have also set checked the time out
of
the server to unlimited". By "the server" I assume you mean the SQL
Server.
But "the time out of the server" means nothing. The SQL Server has no
timeout property. For example, if I have 10 clocks in my house, and I tell
you that I "set the time of my house," which of the 10 clocks did I set?

Can you be more specific?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.

"Saurabh" <sa***********@ hotmail.comwrot e in message
news:OF******** ******@TK2MSFTN GP05.phx.gbl...
Hi,

I am getting the below mentioned error when I try to update a table
Exception: Unable to update Person records Exception :
System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not
responding.

I have also set checked the time out of the server to unlimited. I am
using
the SQLDataReader in my applciation at quite a few palces and make it a
point to close the object and set it to nothing.
Here is the snippet of the code.

SqlDataReader lobj_PersonTabl e =
SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

while(lobj_Pers onTable.Read())
{

}

lobj_CompanyTab le.Close();
lobj_CompanyTab le = null;

But if I check the SQL server enterprise manager, I find a number of
locks/Process Id under current activity. I feel that its these locks that
might be preventing the update statement from executing. Am I missing
something here?

Any help would be appreciated.

Thanks and Regards,
Saurabh


Jul 22 '06 #5
So once again my question,

Which dB connection are you using within the while loop? Is it the same as the one used by the dataReader?
If yes, just use another connection.
- José
"Saurabh Prabhu" <sa***********@ hotmail.coma écrit dans le message de news: %2************* **@TK2MSFTNGP05 .phx.gbl...
Hi,

Sorry I did not explain the issue correctly.

Here I am setting the SQLDataReader object to read from a table
SqlDataReader lobj_PersonTabl e = SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

Now the next line of code is the while loop
while(lobj_Pers onTable.Read())
{

}

Now it is withn this loop that I am executing an update statement using Command object. It is this loop that I am encountering a "time out exception" for every record in the loop. Here is the text
Exception: Unable to update Person records Exception : System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Please let me know If you need anything else.

Thanks and Regards,
Saurabh

"José Joye" <jo************ *************** **********@blue win.chwrote in message news:u5******** ******@TK2MSFTN GP02.phx.gbl...
Looking at your code snippet, I'm not too sure where you are trying to update the table.
Is this within the while loop?
Do you use the same connection object as the one for the DataReader?

If so, here is the problem! Normally a connection currently in use by a dataReader is not available for any other activity...
You have either to use another one or close the dataReader first.

- José
"Saurabh" <sa***********@ hotmail.coma écrit dans le message de news: OF************* *@TK2MSFTNGP05. phx.gbl...
Hi,

I am getting the below mentioned error when I try to update a table
Exception: Unable to update Person records Exception : System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.



I have also set checked the time out of the server to unlimited. I am using the SQLDataReader in my applciation at quite a few palces and make it a point to close the object and set it to nothing.
Here is the snippet of the code.

SqlDataReader lobj_PersonTabl e = SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

while(lobj_Pers onTable.Read())
{

}

lobj_CompanyTab le.Close();
lobj_CompanyTab le = null;

But if I check the SQL server enterprise manager, I find a number of locks/Process Id under current activity. I feel that its these locks that might be preventing the update statement from executing. Am I missing something here?

Any help would be appreciated.

Thanks and Regards,
Saurabh

Jul 22 '06 #6
Saurabh,
I suggest that you simplify the connection issue by starting out with a
DataSet instead of a DataReader. Once your connection is closed, you can
iterate over the rows in the DataTable it contains and handle your updates
without having to be concerned about SqlConnection issues.
Peter

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


"Saurabh" wrote:
Hi,

I am getting the below mentioned error when I try to update a table
Exception: Unable to update Person records Exception : System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

I have also set checked the time out of the server to unlimited. I am using the SQLDataReader in my applciation at quite a few palces and make it a point to close the object and set it to nothing.
Here is the snippet of the code.

SqlDataReader lobj_PersonTabl e = SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

while(lobj_Pers onTable.Read())
{

}

lobj_CompanyTab le.Close();
lobj_CompanyTab le = null;

But if I check the SQL server enterprise manager, I find a number of locks/Process Id under current activity. I feel that its these locks that might be preventing the update statement from executing. Am I missing something here?

Any help would be appreciated.

Thanks and Regards,
Saurabh
Jul 23 '06 #7
Are you creating a new Connection inside the loop? That would be a mistake,
as a new Connection would be created with every iteration of the loop. And,
as others have mentioned, you cannot use the same Connection as the
DataReader.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.
"Saurabh Prabhu" <sa***********@ hotmail.comwrot e in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hi,

Sorry I did not explain the issue correctly.

Here I am setting the SQLDataReader object to read from a table
SqlDataReader lobj_PersonTabl e =
SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

Now the next line of code is the while loop
while(lobj_Pers onTable.Read())
{

}

Now it is withn this loop that I am executing an update statement using
Command object. It is this loop that I am encountering a "time out
exception" for every record in the loop. Here is the text
Exception: Unable to update Person records Exception :
System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not
responding.

Please let me know If you need anything else.

Thanks and Regards,
Saurabh
"Kevin Spencer" <uc*@ftc.govwro te in message
news:O7******** ******@TK2MSFTN GP02.phx.gbl...
>I can't figure out what you mean by "I have also set checked the time out
of
>the server to unlimited". By "the server" I assume you mean the SQL
Server.
>But "the time out of the server" means nothing. The SQL Server has no
timeout property. For example, if I have 10 clocks in my house, and I
tell
you that I "set the time of my house," which of the 10 clocks did I set?

Can you be more specific?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.

"Saurabh" <sa***********@ hotmail.comwrot e in message
news:OF******* *******@TK2MSFT NGP05.phx.gbl.. .
Hi,

I am getting the below mentioned error when I try to update a table
Exception: Unable to update Person records Exception :
System.Data.Sq lClient.SqlExce ption: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not
responding.

I have also set checked the time out of the server to unlimited. I am
using
>the SQLDataReader in my applciation at quite a few palces and make it a
point to close the object and set it to nothing.
Here is the snippet of the code.

SqlDataReade r lobj_PersonTabl e =
SqlHelper.Exec uteReader(GDFCo nnectionReader, CommandType.Tex t,lstr_SQL);

while(lobj_Per sonTable.Read() )
{

}

lobj_CompanyTa ble.Close();
lobj_CompanyTa ble = null;

But if I check the SQL server enterprise manager, I find a number of
locks/Process Id under current activity. I feel that its these locks that
might be preventing the update statement from executing. Am I missing
something here?

Any help would be appreciated.

Thanks and Regards,
Saurabh



Jul 23 '06 #8
Hi Saurabh,

Could you post the entire portion of the code, starting with the creation of
the Connection (and the Connection String) for the updates, the creation of
the Connection (and the Connection String) for the DataReader, and all the
code inside the loop?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Sequence, Selection, Iteration.
"Saurabh" <sa***********@ hotmail.comwrot e in message
news:Oa******** ******@TK2MSFTN GP03.phx.gbl...
Hi,

Thanks for your suggestions. But I am still stuck. Please have a look at my
answers for all your questions.

{José}Looking at your code snippet, I'm not too sure where you are trying to
update the table.
Is this within the while loop? Do you use the same connection object as the
one for the DataReader?

If so, here is the problem! Normally a connection currently in use by a
dataReader is not available for any other activity...
You have either to use another one or close the dataReader first.
Yes, I am executing the update query within the for loop and the connection
is different from the one used for the reader. I cannot close the data
reader because I will not be able to get the data from the data reader. So
in short there are 2 connections. One for data reader which is used only
once and other to update the records in the for loop. JFYI, the for loop is
iterated 200 times for as many as 6 times
{Kevin Spencer}Are you creating a new Connection inside the loop? That would
be a mistake, as a new Connection would be created with every iteration of
the loop. And, as others have mentioned, you cannot use the same Connection
as the DataReader.
Kevin, please have a look at the explanation provided above. Also I am not
creating a new connection in every loop. It is just opened once at the class
constructor and closed when the class terminates.

{Peter}I suggest that you simplify the connection issue by starting out with
a DataSet instead of a DataReader. Once your connection is closed, you can
iterate over the rows in the DataTable it contains and handle your updates
without having to be concerned about SqlConnection issues.
I cannot use the DataSet as it would result in getting the data stored in
memory, which is not advisible in my case. DataReader is fast and also since
I need to just read data it seems to be the right choice.

Another point that I failed to mention in my previous posts. This is not a
SQL server but an instance of a SQL server created. Please have a look at
the attached screen shot for more information.

Waiting for your replies.

Thanks and Regards,
Saurabh
--------------------------------------------------------------------------------

"Saurabh" <sa***********@ hotmail.comwrot e in message
news:OF******** ******@TK2MSFTN GP05.phx.gbl...
Hi,

I am getting the below mentioned error when I try to update a table
Exception: Unable to update Person records Exception :
System.Data.Sql Client.SqlExcep tion: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not
responding.

I have also set checked the time out of the server to unlimited. I am
using the SQLDataReader in my applciation at quite a few palces and make it
a point to close the object and set it to nothing.
Here is the snippet of the code.

SqlDataReader lobj_PersonTabl e =
SqlHelper.Execu teReader(GDFCon nectionReader,C ommandType.Text ,lstr_SQL);

while(lobj_Pers onTable.Read())
{

}

lobj_CompanyTab le.Close();
lobj_CompanyTab le = null;

But if I check the SQL server enterprise manager, I find a number of
locks/Process Id under current activity. I feel that its these locks that
might be preventing the update statement from executing. Am I missing
something here?

Any help would be appreciated.

Thanks and Regards,
Saurabh
Jul 25 '06 #9

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

Similar topics

8
27624
by: Stephan | last post by:
I'm fairly new to python and am working on parsing some delimited text files. I noticed that there's a nice CSV reading/writing module included in the libraries. My data files however, are odd in that they are composed of lines with alternating formats. (Essentially the rows are a header record and a corresponding detail record on the next line. Each line type has a different number of fields.) Can the CSV module be coerced to read...
8
2530
by: Todd Bright | last post by:
Is there a way to get the current XmlNode from the reader while in the validation event handler? What I'd like to do is display the error message along with the name of its parent node. In my XML format, there are parent nodes named differently with some of the same names for child nodes, so when I get an error message that references the 'LOGICALPOCKET' node that could be under more than one different parent node. I need to be able to...
1
1922
by: Anand | last post by:
I just implemented a program to solve reader writter prob. Wenever I run the program it seems to go into S+ state and it waits there I dont know why. When i attach gdb to one of the childs and step through for some lines and dettach it runs for some time again ????? The program is listed below. The listing is kind of long
3
1247
by: BrianDH | last post by:
I got my news reader (Outlook) set up and can download the messages, but when I try to post or respond to a message I get this error. Your message was not delivered because the destination computer was not found. Carefully check that it was spelled correctly and try sending it again if there were any mistakes. It is also possible that a network problem caused this situation, so if you are sure the address is correct you might want to...
12
11187
by: Jerry Camel | last post by:
Not sure if this is a good place to post this... I'm writing and ASP.net app using vb .net. I need to interact with a credit card reader. I have one that sits inline with the keyboard. Works great, except for the fact that no matter what field the user is in on the transaction page (Name, Address, Credit Card number) the reader will dump the data at the cursor. So, if the user is in the name field and they happen to swipe the card,...
6
1478
by: Jim Heavey | last post by:
I am new to SqlServer, have been using Oracle in a prior life. I have written a very simple stored procedure in SQL Server and it (the query) looks like the following... Select AD_ID, First_Name, Last_Name, User_Type, Phone_Nbr, Email_Addr From dbo.User_Tbl Where UPPER(AD_ID) = UPPER(@AD_ID) and UPPER(User_Type) = UPPER(@User_Type)
1
4097
by: vbDavidC | last post by:
Hi, I am fairly new to .net and objects. I learned to create a reader object in method 1, however if I wanted to create multiple select queries in the same module I did not know how to reuse the same code, I would like to verify if method 2 is the right way to reuse the same reader object. If this is the case could I open a reader object (that is global) at
6
4975
by: dgleeson3 | last post by:
Hello All I have VB code (.Net 2005) reading from an SQL server 2005 database. Im getting InvalidCastException when doing reader.GetInt32(0) Im simply reading an int from a simple database. It has two columns, User and Tel number. User is filled with 1,2,3 and tel number has 3 telephone numbers. The User data column is specified as (PK, int, not null) in MS SQL
9
3986
by: Mike P | last post by:
Hi All, I want to read in a CSV file, but then write out a new CSV file from a given line.. I'm using the CSV reader and have the the line where i want to start writing the new file from begins with "Transaction ID", i thought it should be something along the lines of below.. obvioulsy
0
9584
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
10583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
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...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5525
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...
1
4301
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
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
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.