Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. public firmCustomerTable()
  2. {
  3. InitializeComponent();
  4. MySqlConnection connection;
  5. config conf = new config();
  6. connection = new MySqlConnection(conf.connection_string);
  7. DataTable schema = null;
  8.  
  9. using (var con = new MySqlConnection(conf.connection_string))
  10. {
  11. using (var schemaCommand = new MySqlCommand("SELECT * FROM firmenkunden", con))
  12. {
  13. con.Open();
  14. using (var reader = schemaCommand.ExecuteReader(CommandBehavior.SchemaOnly))
  15. {
  16. schema = reader.GetSchemaTable();
  17. }
  18. }
  19. }
  20. foreach (DataRow col in schema.Rows)
  21. {
  22. System.Windows.Controls.TextBox newTxt = new TextBox();
  23. System.Windows.Controls.CheckBox onoff = new CheckBox();
  24.  
  25. // Add Label
  26. newTxt.Text = col.Field<String>("ColumnName");
  27. newTxt.Name = col.Field<String>("ColumnName");
  28. newTxt.Width = 200;
  29.  
  30.  
  31. // Add OnOff
  32. onoff.HorizontalAlignment = HorizontalAlignment.Center;
  33. onoff.Style = (Style)FindResource("CheckBoxStyle1");
  34. onoff.VerticalAlignment = VerticalAlignment.Center;
  35.  
  36. // Add To Panel
  37. sp.Children.Add(newTxt);
  38. sp.Children.Add(onoff);
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement