Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a Form that has Client Information and some Order Information
when user Change some thing
and press Update
two separate Function called
updclient();
updorder();
i want to show only one Message Box showing that "update Successfull"

is there any way to check both updates status and show only one MessageBox ?
Currently i am using this method
updorder()
C#
int a=adapter.InsertCommand.ExecuteNonQuery();
                cmd.Connection.Close();
                if (a == updatecheck)
                {
                    stmessage.Text = "Update Successfull...";
                }

updclient()
SQL
SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.InsertCommand = cmd;
                updatecheck = adapter.InsertCommand.ExecuteNonQuery();//updatechecked is Globle veriale
                cmd.Connection.Close();

first updclient() called which fill updatecheck variable with return value
second updorder() called which checked his a variable with updatecheck veriable
Posted
Comments
ZurdoDev 6-Feb-14 14:27pm    
Sure. Just check your return values and make sure to return what you want. I'm confused as to where you are stuck.

off course you can do this with the help of int variable, when we call this function must be return int type of value, like this see my snippet code
SQL
Update TableName set column Name=(Value of want to update) where column Name=Condition

When execute this query with help of
ExecuteNonQuery()
Must be Return int type of Value like that 1 or 0. I hope you understand what i trying in my line.
hit to replay for any query or problem.

Happy coding
jsb
 
Share this answer
 
Comments
abdul manan 7 6-Feb-14 23:54pm    
What it returns when an update query successfully run
in may case it return -1 is it correct
For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command

so you should insert equal no of rows in both the method, then only the condition will satisfy.
 
Share this answer
 

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