Click here to Skip to main content
15,911,360 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how and where can i override the ExecuteNonQuery() in c# application for orcaleCommand

public override int ExecuteNonQuery()
{
//myCode
}


this is the function but i don't know where i should write it in the application
Posted
Comments
Herman<T>.Instance 18-Sep-11 9:02am    
show your code where you want to call the ExecuteNonQuery

as long as you have it not declared abstract you don't need override.
 
Share this answer
 
Comments
marjavic 18-Sep-11 9:01am    
i don't understand

i need to add an action while the function is execution like this

public override int ExecuteNonQuery()
{
// do some thing;
base.ExecuteNonQuery();
}

but i don't know where i call the override function
marjavic 18-Sep-11 9:23am    
this.mySql.sqlDataAdapter1.InsertCommand.CommandText

= " INSERT INTO statement ";

this.mySql.sqlDataAdapter1.InsertCommand.ExecuteNonQuery();

< this.mySql > is an object of class has the orcaleCommands Initialization {insertCommand , deleteCommand , updateCommand , OracleDataAdapter and my OracleConnection}


i want to override the ExecuteNonQuery() function with an action additional to it's basic function
inorder to override the method you first have to inherit the class OracleCommand and that is not possible as OracleCommand is sealed.
So you'll have to find another way to achieve what you want, like something as ugly as a wrapper would help you.
 
Share this answer
 
Comments
marjavic 18-Sep-11 9:36am    
i already have an ugly solution it's by adding my action after evry ExecuteNonQuery() function but my application is big and i'll repeate this in another application i'm searching a solution to not repeate the same function in all application
Simon Bang Terkildsen 18-Sep-11 9:39am    
Yeah, I just gave you another option: a wrapper.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900