SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : Microsoft .NET :

Previous DiscussionNext Discussion
 C# OleDbCommand.ExecuteNonQuery() hangs

I have the following:

OleDbConnection odbConn;
OleDbDataAdapter odbAdapter;
OleDbCommand odbCommand;

public void UpdateRecord()
{
try
{
odbAdapter = new OleDbDataAdapter();
odbCommand = new OleDbCommand(QueryToExecute, odbConn);

odbConn.Open();
odbCommand.ExecuteNonQuery();
odbConn.Close();
}
catch (Exception ex)
{
throw new Exception(ex.Message.ToString());
}
}

And the odbCommand.ExecuteNonQuery() just hangs. It never proceeds beyond that line, to the odbConn.Close(), nor does it throw an exception.

The connection string is correct, because I can get data, and the query itself works, so what could be the problem?

This is a console app, if that makes a difference.

Started By Monte on Jun 16, 2009 at 10:40:02 AM

6 Response(s) | Reply

Earlier Replies | Replies 1 to 6 of 6 | Later Replies
Monte on Jun 16, 2009 at 12:12:07 PM (# 1)

Never mind. I figured it out.

I forgot to do a commit in my DB IDE. the ExecuteNonQuery was waiting for the transaction to complete. Since there was no commit, the transaction didn't complete.

Oops.


omega160 on Feb 3, 2011 at 2:51:04 PM (# 2)

Can you explain furthur how you did this....code example?  I am having the exact same issue?


Monte on Feb 4, 2011 at 5:18:10 AM (# 3)

The code sample above does work. If I remember right, I just had to do a commit in my actual DB IDE. So try doing a commit on whatever DB you're using. If anyone has made modifications to the database through the IDE, have them do a commit. That's what fixed the issue for me.


omega161 on Feb 4, 2011 at 6:09:24 AM (# 4)

So basically if I had a SQLPlus session up to my oracle database and did an update in table but never did a commit or quit the SQLPlus session and then tried to do an update on the same table via my application I would get the hanging.  If I do a commit in SQLPlus then execute an update from my application it shouldnt hang, correct??


omega161 on Feb 4, 2011 at 9:21:56 AM (# 5)

Thanks for pointing me in the right direction, all appears to be working now.


Monte on Feb 4, 2011 at 1:35:05 PM (# 6)

No problem. As you can see, the original solution took me about two hours to figure out after I made the initial post.


Earlier Replies | Replies 1 to 6 of 6 | Later Replies

To respond to a discussion, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password
Copyright 1997-2004 InsideDHTML.com, LLC. All rights reserved.