Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void frmMain_Load(object sender, EventArgs e)
- {
- //TEXT BOX DISABLED
- txtDv.Enabled = false;
- txtNombre.Enabled = false;
- txtApellido.Enabled = false;
- txtCorreo.Enabled = false;
- txtTelefono.Enabled = false;
- //LLENAR COMBOBOX DESDE BD
- using (SqlConnection conn = new SqlConnection("Data Source = DESKTOP-0PSJQKP; initial Catalog = BDControlEPP; User = sa; Password = a123456"))
- {
- try
- {
- string query = "select idItem, nombreItem from tblItems";
- SqlDataAdapter da = new SqlDataAdapter(query, conn);
- conn.Open();
- DataSet ds = new DataSet();
- da.Fill(ds, "Items");
- cbItems.DisplayMember = "nombreItem";
- cbItems.ValueMember = "idItem";
- cbItems.DataSource = ds.Tables["Items"];
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
Add Comment
Please, Sign In to add comment