1
Answer

datagridview

ta mu

ta mu

11y
909
1
 int rowindex;
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            my.Open();
           
           string cellvalue = dataGridView1["id", rowindex].Value.ToString();
            SqlCommand cmd = new SqlCommand("SELECT * FROM reminder WHERE id='" + cellvalue + "'", my);
            SqlDataReader rd = cmd.ExecuteReader();
            rd.Read();
            upr.textBox1.Text = rd["message"].ToString();


            upr.label1.Text = rd["id"].ToString();

            my.Close();
        }

i have this code and i want when mouse double click reader  reads from database where id is equals selected cell but every time i got id and messag of
only first row of datagridview. is there problem with my int (rowidex variable) any other way to do this
Answers (1)