nagasi conan

nagasi conan

  • NA
  • 2
  • 483

how to auto compelete datagridview ?

Mar 15 2020 8:29 AM
 
 
i wan to make columns "kode Barang " get value data from database and then columns "nama Barang" auto compelete.
 
  1. private void _auto()  
  2.         {  
  3.             string str;  
  4.             conn = config.Connetion;  
  5.             conn.Open();  
  6.             try  
  7.             {  
  8.                 str = "SELECT * FROM db_stok where kode_barang = '" + DG_masuk.Rows[3].Cells[3].Value.ToString() + "'";  
  9.                 CMD = new MySqlCommand(str, conn);  
  10.                 dr = CMD.ExecuteReader();  
  11.   
  12.                 while (dr.Read())  
  13.                 {  
  14.                     string nama_barang = dr.GetValue(1).ToString();  
  15.                     DG_masuk.Rows[4].Cells[4].Value = nama_barang;  
  16.                 }  
  17.             }  
  18.   
  19.             catch (Exception ex)  
  20.             {  
  21.                 MessageBox.Show("erorr!!" + ex.Message);  
  22.             }  
  23.         }  
 
 
 

Answers (2)