"i am begineer" - ok
"i want urgent answer" - not ok - people on this site are volunteers, ie do not get paid - we are not your servants - I suggest you learn some manners
I can't see why you're complicating things with a datatable - you seem to want a straightforward decimal (money) result back, so off the top of my head, wouldn't something like this
public Decimal slectbill(string connString)
{
Decimal bill = 0;
string query = "select sum(subTotal) as bill from Cashout";
using (SqlConnection conn = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand(sql, conn);
try
{
conn.Open();
bill = (Decimal)cmd.ExecuteScalar();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
return bill;
}
make more/better sense ?