ta mu

ta mu

  • NA
  • 201
  • 82.2k

datagridview

Sep 21 2013 1:25 PM
 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)