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();
IsraelPosted Jan 24, 2018, 9:14 AM
Laxmidhar SahooPosted Jan 19, 2018, 10:41 AM
IsraelPosted Jan 19, 2018, 7:32 AM
Laxmidhar SahooPosted Jan 19, 2018, 2:15 AM
Lahiru MahagamagePosted Jan 18, 2018, 9:39 PM