charan sekhar

charan sekhar

  • NA
  • 108
  • 0

querry returning zero value even though data is present in data base using asp.net with c#

Jun 14 2010 4:41 AM

hi iam usin asp.net with c#
querry is returning zero value even though  it is returning session value and data is present in data base
can you correct my code which helps me
 
 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();


Answers (1)