Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
5
Answers
Forced to display to the label after last row selected
Israel
6y
173
1
Reply
Hi!
Anyone can help please. I have these code and I need to display only the last row of datagrid on my label.
This first line it's works:
dgvNprint.CurrentCell = dgvNprint.Rows[dgvNprint.Rows.Count - 2].Cells[0];
the whole code:
...On Button_Click
dgvNprint.CurrentCell = dgvNprint.Rows[dgvNprint.Rows.Count - 2].Cells[0];
string
connectionString = @
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\\table.mdb;Persist Security Info=False"
;
OleDbConnection sqlCon = newOleDbConnection(connectionString);
sqlCon.Open();
string
commandString =
"select * from companyname where S='order by ID"
+ '*
' + "'
";
OleDbCommand sqlCmd = newOleDbCommand(commandString, sqlCon);
OleDbDataReader read = sqlCmd.ExecuteReader();
while
(read.Read())
{
lblNumberprint.Text = read[
"ID"
].ToString();
// it will show your friend's name
}
sqlCon.Close();
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
Random Duplicate Results From SSRS
Regarding Connection pooling