Guest User

Untitled

a guest
Mar 12th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. private void frmMain_Load(object sender, EventArgs e)
  2. {
  3. //TEXT BOX DISABLED
  4. txtDv.Enabled = false;
  5. txtNombre.Enabled = false;
  6. txtApellido.Enabled = false;
  7. txtCorreo.Enabled = false;
  8. txtTelefono.Enabled = false;
  9.  
  10. //LLENAR COMBOBOX DESDE BD
  11. using (SqlConnection conn = new SqlConnection("Data Source = DESKTOP-0PSJQKP; initial Catalog = BDControlEPP; User = sa; Password = a123456"))
  12. {
  13. try
  14. {
  15. string query = "select idItem, nombreItem from tblItems";
  16. SqlDataAdapter da = new SqlDataAdapter(query, conn);
  17. conn.Open();
  18. DataSet ds = new DataSet();
  19. da.Fill(ds, "Items");
  20. cbItems.DisplayMember = "nombreItem";
  21. cbItems.ValueMember = "idItem";
  22. cbItems.DataSource = ds.Tables["Items"];
  23.  
  24. }
  25. catch (Exception)
  26. {
  27.  
  28. throw;
  29. }
  30. }
  31.  
  32. }
Add Comment
Please, Sign In to add comment