Why would a statement execute in Toad but not in my code?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
clayshannon
Posts: 6
Joined: Mon 09 Jan 2006 17:05
Location: Waterford, WI

Why would a statement execute in Toad but not in my code?

Post by clayshannon » Wed 09 May 2012 22:25

Here is my C# code:

Code: Select all

private void UpdatePlatypus(String APetPlatypus) 
{
	oracleConnectionMainForm.Open();
	OracleCommand ocmd = new OracleCommand();
	ocmd.Connection = oracleConnectionMainForm;
	try 
	{
		ocmd.CommandText = @"<Update SQL statement that contains one parameter, like so: "WHERE DUCKBILLEDPLATYPUS = 				:PLATYPUS">)";
		ocmd.Parameters.Add("PLATYPUS", APetPlatypus);
		ocmd.ExecuteNonQuery();
	} 
	catch (Exception e) 
	{
		MessageBox.Show(String.Format("UpdatePlatypus failed with message {0}", e.Message));
	} 
	finally 
	{
		oracleConnectionMainForm.Close();
	}
	MessageBox.Show(String.Format("UpdatePlatypus to {0} succeeded", APetPlatypus));
}
In Toad, this SQL works fine -- I simply replace ":PLATYPUS" with the value "Phineas" in the Toad SQL editor, and the records are, indeed, updated, as the "27 records affected" message and a subsequent SQL Select that returns the updated records shows.

But in my C# app, it hangs on the call to ExecuteNonQuery()...I never see any of the messages - neither that the Update failed, nor that it succeeded - it simply hangs there, floating about in space like a smurf ball on the moon.

clayshannon
Posts: 6
Joined: Mon 09 Jan 2006 17:05
Location: Waterford, WI

Re: Why would a statement execute in Toad but not in my code

Post by clayshannon » Thu 10 May 2012 16:27

Today it works just fine - same code.

So the "hanging" yesterday I guess was a problem with the database?

I'm still curious why I could update it in Toad but not from Visual Studio with the dotConnect components with the exact same SQL statement (that works today without a hitch).

Post Reply