8
Answers

How to calculate( sum) of the data grid column.

Hi all,
 
I have retreive data to a data grid without sqldatasource.
 
private void BindGrid2()
{
string constr = (ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString);
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT * FROM OnlineDiary_tb where U_EmailAddress='" + Session["U_Email"].ToString() + "'and Date='"+ DateTime.Today.ToString()+"' ", con))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
GridView2.DataSource = dt;
GridView2.DataBind();
}
}
}
}
 
Now want to calculate colunm data.
 
Thank you in advance.

Answers (8)

0
Photo of Vulpes
NA 98.3k 1.5m 13y
Well, the Latest News section on here (see side bar to right) certainly helps in that respect.

If you also join the Code Project site (http://www.codeproject.com/), they'll send you at least one newsletter a day which lists (and links to) relevant articles that have recently been published on other news sites, not just on computing but on science and technology generally. In fact, there's so many that it's difficult to keep up!

Personally, I never look at Twitter (unless linked to by the aforementioned sources) as I find it too shallow for most purposes.


Accepted