TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rajkumar R
NA
183
220k
How to sum a field in the data table
Nov 5 2011 3:17 AM
SqlConnection cn = new SqlConnection("Data Source=.;Initial Catalog=Demo_eLogsVA4;Integrated Security=True");
//Write a select Query
cn.Open();
string q = "Select Invoice_Code,Amount,Tax,Net Where Invoice_Code='INV991'";
DataSet dset = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(q, cn);
DataTable dtable = new DataTable();
da.Fill(dtable);
//Bind grid.
GridView1.DataSource = dtable;
DataRow[] dr = dtable.Select("Sum(Net)");
GridView1.FooterRow.Cells[0].Text = Convert.ToString(dr[0]);
GridView1.DataBind();
cn.Close();
the above is my gridbind method. My table name is dtable, from that dtable i want to sum the amount and net field in the datatable(dtable) and where i want to include the sum code ,Help please
Reply
Answers (
12
)
uploading .wmv files to windows media services
Session get expired and process terminated .How to manage it