I can not retireve record to row in datagridview, using cell_leave event and using the first cell as index to retrieve from database the code is as follows:
private void dgv_CellLeave(object sender, DataGridViewCellEventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=Me; Database=Services;Integrated Security=true");
string str = ("SELECT Code,Category,ItemColor,Price FROM Item WHERE Code='" +col0+ "'");
SqlCommand cmd = new SqlCommand(str, con);
con.Open();
DataTable table = new DataTable();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(table);
dgv.DataSource = table;
}
}
Please can someone help me?
the image
Jignesh KumarPosted Aug 29, 2018, 11:21 AM
Collins AigbekhaiPosted Aug 29, 2018, 6:09 AM
Collins AigbekhaiPosted Aug 29, 2018, 6:08 AM
Jignesh KumarPosted Aug 24, 2018, 10:19 PM
Gaurav RajPosted Aug 24, 2018, 4:20 AM
Jignesh KumarPosted Aug 24, 2018, 3:48 AM