Practically it has many ways, but let me show you 1 way to do so. Here i am going to use Jquery.
First of all create JS function or Jquery function, which required to call on "OnClientClick". Than you have to call the Code Behind method for doing the database operations(If you have such method else create such).
Remember that the method should be
"[WebMethod]"
.
Let consider function name "JqueryFunc" for better understanding.
<script type="text/javascript">
function JqueryFunc(){
PageMethods.SetAllValues(parameter1,parameter2);
}
</script>
Now consider that you have created method in code behind which takes parameters and do required operation in database.
[WebMethod]
public static void SetAllValues(int parameter1, int parameter2)
{
}
And now just call the JS function from the button.
<asp:button runat="server" id="btnFunc" text="Func" onclientclick="JqueryFunc(); return false;"></asp:button>
Hope this will help you.