Hi,
 
 I have a windows application developed in c#.
 I have datagridview with three columns in it.
 I will be scanning barcode in the text box.After scanning a  particular barcode, i need to query the database and fill the barcodes  info in the datagridview columns of the current row.
 Like wise after scanning each barcode i need to fill the particular row like above.
 
 i used this kind of code but its not working ..
 
try
            {
                MySqlConnection con = new MySqlConnection(StartUp.database);
                con.Open();
                MySqlCommand cmd = new MySqlCommand("select Accession_no,Title_in_full from t_book_details where Accession_no ='" + txt_accession_no.Text + "'", con);
                MySqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    dr.Read();
                    gv_show_details.Rows[0].Cells[0].Value = dr[0].ToString();
                    gv_show_details.Rows[0].Cells[1].Value = dr[1].ToString();
                    gv_show_details.Rows.Add(dr);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            } 
 please give me idea where i m doing mistakes..
 
thanks in advance