Click here to Skip to main content
15,881,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is my method i.e GetAmountInBank which getting amount from bank table with the help of Query which is mentioned below the method.

C#
string GetAmountInBank(string Bank)



here is my Query:
C#
strSQL = "select Sum(AmountinBank) from BankAccount,accountitem,accountcategory where accountitem.ItemcatID=accountcategory.CategoryID and BankAccount.ItemID=accountitem.ItemID   and accountcategory.IsExpense=0 and BankId like '" + Bank + "'";



Here is complete Code:

C#
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data;

public partial class Jqurey : System.Web.UI.Page
{
    DBconn db = new DBconn();
   // Security s = new Security();
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
           // user myUsers = new user();
            Response.Expires = -1;
            //required to keep the page from being cached on the client's browser

            Response.ContentType = "text/plain";
            string BankID = Request.QueryString["BankID"].ToString();

            string BankAmount = GetAmountInBank(BankID);
            Response.Write(BankAmount);

           // Session["BankAmount"] = BankAmount;

        }

    }
    string GetAmountInBank(string Bank)
    {
        string strSQL = "select Sum(AmountinBank) from BankAccount,accountitem,accountcategory  where accountitem.ItemcatID=accountcategory.CategoryID  and BankAccount.ItemID=accountitem.ItemID   and accountcategory.IsExpense=1 and BankId like '" + Bank + "'";
        string totalExp = db.selectquery_One(strSQL).ToString();

        if (totalExp == "")
        {
            totalExp = "0";
        }


        strSQL = "select Sum(AmountinBank) from BankAccount,accountitem,accountcategory where accountitem.ItemcatID=accountcategory.CategoryID  and BankAccount.ItemID=accountitem.ItemID   and accountcategory.IsExpense=0 and BankId like '" + Bank + "'";

        string totalDep = db.selectquery_One(strSQL).ToString();

        if (totalDep == "")
        {
            totalDep = "0";
        }

//Having Problem in this Line

        double dResult = Convert.ToDouble(totalDep) - Convert.ToDouble(totalExp);

        return dResult.ToString();
    }


}
Posted
Updated 1-Mar-13 20:04pm
v3
Comments
Naseer A Khan 2-Mar-13 2:02am    
I have posted my Complete Code now please help me to resolve this problem.
Naseer A Khan 2-Mar-13 2:12am    
One thing more i.e
in (totalDep) or in (totalExp) the System.Byte[] array in fetched, i just mark the break point on my method and then Run my code line by line so i found this Error.

1 solution

Datatype Conversion.

It is sometimes beneficial to convert a value from one type of data to another. Each of the conversion functions converts its parameter to an equivalent representation within its datatype. The conversion functions include int(), float(), char(), byte(), and others.


C#
// The next line is needed if running in JavaScript Mode with Processing.js
/* @pjs font="Georgia.ttf"; */

size(640, 360);
background(0);
noStroke();

textFont(createFont("Georgia",24));

char c;    // Chars are used for storing alphanumeric symbols
float f;   // Floats are decimal numbers
int i;     // Integers are values between 2,147,483,647 and -2147483648
byte b;    // Bytes are values between -128 and 128

c = 'A';
f = float(c);      // Sets f = 65.0
i = int(f * 1.4);  // Sets i to 91
b = byte(c / 2);   // Sets b to 32

//println(f);
//println(i);
//println(b);

text("The value of variable c is " + c, 50, 100);
text("The value of variable f is " + f, 50, 150);
text("The value of variable i is " + i, 50, 200);
text("The value of variable b is " + b, 50, 250);



Processing was initiated by Ben Fry and Casey Reas. It is devel
 
Share this answer
 
v2

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