Click here to Skip to main content
16,014,613 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
private double totalPrice(double r)
{
connection...
command...
command.commandtext = "select @gg = SUM(TotalPrice) FROM inventoryout";
command.parameters.addwithvalue("@gg", r);
command.prepare();
cmd.executenonquery();
con.close()
return r;
}


the sum of totalPrice from inventoryout = 50000;
Posted
Updated 8-Mar-15 22:03pm
v2
Comments
_bluRe_ 9-Mar-15 4:15am    
how can i call this method with parameter(totalPrice(double r)) and place its value into a command.para.addwithvalue in the button event?

1 solution

Just forget the parameter and do this:
C#
command.commandtext = "select SUM(TotalPrice) FROM inventoryout";
int total = cmd.ExecuteScalar();
 
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