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
Karan Gupta
NA
29
15k
how to print sum(amount) in label
Apr 10 2015 9:10 AM
i want to print a sum (amount) in label windows form --- from sql
my code is ... it is not working
i
SqlCommand com = new SqlCommand("SELECT sum(amount) from custpurches where name='" + comboBox1.Text + "'", con);
try
{
con.Open();
SqlDataReader dr = com.ExecuteReader();
con.Close();
if (dr.Read())
{
label1.Text = dr["amount"].ToString();
dr.Close();
con.Close();
}
else
{
MessageBox.Show("error");
dr.Close();
con.Close();
}
}
catch (Exception ex)
{
MessageBox.Show("Try again or Refresh", "message");
}
Reply
Answers (
0
)
Regular Expression
Regular Expression2