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
Israel
702
1.3k
216.4k
Read the last record...
Feb 19 2015 11:46 AM
Hi!
I need to read only the last record bringing this data here (
lblTotalBancoCons.Text
). But I receive this error:
Object cannot be cast from DBNull to other types.
DataTable dt = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(dt);
conn.Close();
dvgBancoCons.DataSource = dt;
///////////////////////////////////
int sum = 0;
for (int i = 0; i < dvgBancoCons.Rows.Count; ++i)
{
sum += Convert.ToInt32(dvgBancoCons.Rows[i].Cells[10].Value);
lblTotalBancoCons.Text
= " " + sum.ToString();
dvgBancoCons.CurrentCell = dvgBancoCons.Rows[dvgBancoCons.Rows.Count - 1].Cells[0];
Reply
Answers (
3
)
SQL Dynamic Query - from 5 tables
Difference between managed code and managed data ?