- string Bill;
- protected void Page_Load(object sender, EventArgs e)
- {
- Bill = "22-01-2020 ";
- if (!IsPostBack)
- {
- cash();
- }
- }
- protected void cash()
- {
- string query = "select SUM((CASE WHEN ISNUMERIC([Total])=1 THEN CONVERT(MONEY,[Total]) ELSE 0 END))AS [Amount] from Bill where Bdate = CONVERT(DATETIME, '" + Bill + "', 105) and Btype ='Cash'";
- con.Open();
- cmd = new SqlCommand(query, con);
- SqlDataReader dr;
- dr = cmd.ExecuteReader();
- if (dr.Read())
- {
- string amount = dr["Amount"].ToString();
- lblCash.Text = amount.ToString();
- con.Close();
- }
- con.Close();
- }
How to get value from sql server
This query value is Null,
How to i get Sum value from sql
Thanks all

Guest UserRank #816 · 2.8K reputationPosted Feb 25, 2020, 12:18 AM EST
dhoni kholi178 reputationPosted Feb 25, 2020, 12:36 AM EST
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Feb 25, 2020, 12:51 AM EST
Guest UserRank #816 · 2.8K reputationPosted Feb 25, 2020, 1:02 AM EST
dhoni kholi178 reputationPosted Feb 25, 2020, 7:31 PM EST