SqlCommand cmdallltransactions = new SqlCommand("SELECT SUM(Amount) FROM AllTransactions WHERE TransDate BETWEEN '"+ txtfrom.Text +"' and '" + txtto.Text + "' and (TransCode <> 0) and BranchKey=" + Convert.ToInt32(Session["BranchKey"]) + " GROUP by BranchKey", con);con.Open(); txttotal.Text =Convert.ToString(Convert.ToInt64(cmdallltransactions.ExecuteScalar())); con.Close();